简体   繁体   English

Socket.IO 和负载均衡器 (ALB AWS)

[英]Socket.IO and load balancer (ALB AWS)

I've a server that handle HTTP request and Socket.IO service.我有一个处理 HTTP 请求和 Socket.IO 服务的服务器。

My app is running on multiple threads and my socket.io instance are linked to each other thanks to Redis.由于 Redis,我的应用程序在多个线程上运行,并且我的 socket.io 实例相互链接。

Everything is working in local and on production environnement without LB.在没有 LB 的情况下,一切都在本地和生产环境中工作。

Once I setup 2 instances through an Application Load Balancer connections to my server are failing due to transport error ( {"type":"TransportError","description":400})一旦我通过 Application Load Balancer 设置了 2 个实例,由于传输错误({"type":"TransportError","description":400})连接到我的服务器失败

But if I try to connect by ip address directly (To one server) it's working.但是,如果我尝试通过 ip 地址直接连接(到一台服务器),它就可以工作。

The issue seems te be the load balancer, I tried a million things and I don't have any idea anymore...问题似乎出在负载均衡器上,我尝试了一百万件事,但我不再有任何想法......

I activated Stickiness and my target groups, no changes.我激活了粘性和我的目标群体,没有任何变化。

It's like my server accepting Websockets only but not polling.这就像我的服务器只接受 Websockets 但不接受轮询。

In my client, if I just set websocket as protocol it's working, but if I set polling and websocket, it's not working.在我的客户端中,如果我只是将 websocket 设置为协议,它就可以工作,但如果我设置轮询和 websocket,它就不起作用。

Hope someone can helpe me with this issue:)希望有人可以帮助我解决这个问题:)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM