SlackAPI icon indicating copy to clipboard operation
SlackAPI copied to clipboard

WebSocket gets disconnected

Open Jaykul opened this issue 9 years ago • 4 comments

Has anyone been using this library to make bots or clients that rely on the WebSocket connection staying connected? Mine seems to get disconnected after awhile but without any errors I can spot...

Jaykul avatar Aug 04 '16 05:08 Jaykul

@Jaykul , have you had any luck with this? It could just be sporadic connectivity issues on either end of the connection.

Inumedia avatar Nov 18 '16 04:11 Inumedia

I've had this issue with other libraries - I think it's a case of the websocket being closed from Slack's end rather than an error in the library. The solution in the nodejs library I used was to detect when the connection dropped and retry it, up to a maximum number of retries. Might be something that's needed here too? I've only just started using this library but I will take a quick look and see if I can figure out where this should go.

jamiepenney avatar Mar 10 '17 08:03 jamiepenney

same problem here, websocket is closed after awhile without any exceptions.

dherzog90 avatar May 04 '17 06:05 dherzog90

I think I have traced this down to a bug detailed in this article: https://stackoverflow.com/questions/40502921/net-websockets-forcibly-closed-despite-keep-alive-and-activity-on-the-connectio

For this to be the cause you will see a disconnect after about 100 seconds. If this is not the case you just need to create a timer to manage a ping /pong exchange and reconnect if unsuccessful.

There is a workaround but there will need to be a more permanent fix.

Best regards

Ian

iclaxton avatar Apr 17 '20 09:04 iclaxton