mrniko / netty-socketio

Socket.IO server implemented on Java. Realtime java framework
Apache License 2.0
6.8k stars 1.65k forks source link

Unauthorized client with sessionId on Amazon ALB #414

Open bruno-ortizgb opened 8 years ago

bruno-ortizgb commented 8 years ago

Hi there.

I'm trying to build an application that is behind a ALB(Application Load Balancer) on AWS.

The connection is very unstable, and i keep getting the error below:

[nioEventLoopGroup-6-3] WARN  WebSocketTransport - Unauthorized client with sessionId: 56605d99-2fb2-45cb-acb8-2466ed959f93 with ip: /127.0.0.1:56372. Channel closed!

I think that the problem is with the ClientBox that keeps the clients in memory. So when the WebsocketTransport tries to connect, he throws this error, and wont connect at all..

Can anyone help me?

mjxaone commented 8 years ago

Hi. WebSocket protocol is TCP-based protocol independent. It should be understood as a TCP Socket C / S (Client-Server) structure. In other words, it is better to implement the Load Balancer server directly.

↑↑↑↑↑ up language =english(translate) ↑↑↑↑↑ ↓↓↓↓↓ down language =korean(origin) ↓↓↓↓↓

웹소켓 프로토콜은 독립적인 TCP 기반의 프로토콜이다. TCP Socket C/S(Client-Server) 구조로 이해해야한다. 즉, Load Balancer 서버를 직접 구현하는 편이 좋다.

pablojr commented 8 years ago

@bruno-ortizgb although not familiar with AWS / ALB product per se, I expect somebody using a Load Balancer to provide his users with a single entry point to his application/service (the ALB) and then the ALB to distribute/send the request to n+1 (ideally n>1) servers providing such application/service. So are you running several netty-io servers at the same time? if so, you should check with Amazon why they're closing the connections from your ALB to your netty-io servers. I expect the ALB to keep the connection to a particular netty-io server for a given websocket request until netty-io or the client close such connection.