slact / nchan

Fast, horizontally scalable, multiprocess pub/sub queuing server and proxy for HTTP, long-polling, Websockets and EventSource (SSE), powered by Nginx.
https://nchan.io/
Other
2.99k stars 292 forks source link

WebSocket Closing #674

Open hrithwikbharadwaj opened 11 months ago

hrithwikbharadwaj commented 11 months ago

I have a HA setup with Nchan (Redis Clusters + Load balancer with multiple EC2 Instances).

But When I subscribe to a channel using websocket, The Socket Connection is getting closed after 60 seconds.

I thought of doing a HeartBeat call every 60 seconds while subscribed to a channel but it doesn't allow it since the route is only for subscribing and not publishing(makes sense).

I tried increasing the timeout to 3600 in the load balancer , but the connection is getting closed after 5 minutes. we might need active connection for more than 2 hours.

(Also this was not an issue when nchan was installed in single machine without loadbalancer)

Any Suggestions / Fix ?

hrithwikbharadwaj commented 10 months ago

Update: Switched to SSE and added these directives

nchan_eventsource_ping_data "heartbeat"; nchan_eventsource_ping_interval 2;

but with Websockets, the below directive is not sending ping every x number of seconds nchan_websocket_ping_interval 2;