如何在 aws lambda 函数中使用 Socket.io [英] How to use Socket.io in aws lambda functions

查看:36
本文介绍了如何在 aws lambda 函数中使用 Socket.io的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在为我的 Web 应用程序使用带有 aws lambda 函数的节点 js.我想在我的网络应用程序中使用网络套接字.而 socket.io 是一个非常有名的 node.js 库.

I'm using node js with aws lambda functions for my web application. I want to use web socket in my web app. And socket.io is a very famous library for node.js.

但我不确定如何在 aws lambda 中使用它.谁能告诉我怎么做,可以使用 lambda 函数吗?

But I'm not sure how can I use it in aws lambda. can anyone let me know how to do it, is it possible using lambda functions?

推荐答案

无法将 socket.io 与 lambdas 一起使用.Lambda 的执行时间有限制,因此不可能与客户端保持开放连接.

Can't use socket.io with lambdas. Lambdas have a limit on time it can be executed, so holding open connection with a client is impossible.

您可以做的是使用 SNS.Lambdas 可以向 SNS 主题发布消息,Lambdas 可以通过 SNS 调用.

What you can do though is use SNS. Lambdas can publish messages to SNS topics and lambdas can be invoked with SNS.

这篇关于如何在 aws lambda 函数中使用 Socket.io的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆