AWS Elastic Beanstalk上带有socket.io的Websocket [英] Websockets with socket.io on AWS Elastic Beanstalk

查看:109
本文介绍了AWS Elastic Beanstalk上带有socket.io的Websocket的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在AWS Elastic Beanstalk上使用socket.io设置Websocket服务器.收到了对/socket.io/1/?t=xxxx的初始请求并开始运行,但websocket握手失败,并显示以下错误:

I'm trying to setup a websocket-server with socket.io on AWS Elastic Beanstalk. Got the initial request to /socket.io/1/?t=xxxx up and running but the websocket handshake fails with this error:

WebSocket connection to 'ws://xxxxxx.elasticbeanstalk.com/socket.io/1/websocket/a4DTCN2BeJZuiSaphVyz' failed: Unexpected response code: 502 

通过谷歌搜索并查看错误502(错误网关),似乎与nginx-proxy有关.那么,如何配置Nginx以与WebSocket一起使用?

From googling and looking at the error 502 (Bad Gateway) it seems to have something to do with the nginx-proxy. So how do I configure the nginx to work with websockets?

在AWS文档中找不到有关设置websocket的任何信息.

Can't find anything in AWS documentation about setting up for websockets.

推荐答案

您可以尝试解决配置nginx的麻烦,但是如果仅使用websocket,则关闭所有代理并直接连接会更容易.

you could try to go through the trouble of configuring nginx, but if you are only using websockets, it would be easier to turn off all proxys and directly connect.

这是在弹性beantalk仪表板中的应用程序环境下.右侧有一个下拉按钮,标记为动作".选择编辑/加载配置"

this is under your app environment in the elastic beanstalk dashboard. There's a drop down button on the right marked "Actions". Select "Edit/Load Configuration"

这篇关于AWS Elastic Beanstalk上带有socket.io的Websocket的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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