Is it possible to use Socket.io with AWS Lambda?

后端 未结 8 1461
深忆病人
深忆病人 2021-01-30 01:31

Is it possible to build a function in AWS Lambda that creates a websocket and send data to subscribed applications?

Something like this:

John has the app SuperPh

8条回答
  •  -上瘾入骨i
    2021-01-30 02:17

    I don't think that Lambda is going to work for the case you described here. The link to the AWS forum below points out that the Lambda function can only run for a maximum of 15 minutes and further since you are charged per 100ms of function runtime this would probably be cost-prohibitive. There is a comment from Amazon saying they've heard the request several times so are interested in some way to allow for this.

    https://forums.aws.amazon.com/thread.jspa?threadID=205761

    Here is a post from someone who appears to have a good deal of success using EC2 and NodeJS but he had to use an alternative to Socket.io called Websockets/ws.

    http://www.jayway.com/2015/04/13/600k-concurrent-websocket-connections-on-aws-using-node-js/

    If you plan to run your server behind a load balancer it looks like you are going to have a few more hoops to jump through:

    https://web.archive.org/web/20160118124227/http://coding-ceo.ghost.io/how-to-run-socket-io-behind-elb-on-aws

提交回复
热议问题