-
Notifications
You must be signed in to change notification settings - Fork 176
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to prevent the bot auto disconnect? #140
Comments
Also running into this issue. No error messages in Node - app is still running fine but all of a sudden after 5-6 hours it is not responding to user input from Slack. |
How did you solve app is still running fine? Did you changed the original creator code of his API? |
Sorry if I was unclear. I am having the exact same issue you are having. Running my slackbot on Ubuntu with PM2 but it disconnects after 5 to 6 hours or so. I don't get error messages in node and it appears the connection to Slack is absolutely fine - however it stops responding to peoples messages from Slack. |
The only way I can see to not fixing the x but the y is using crontab and making sure the bot will turn off and turn on again after 2 hours or something. |
Funnily enough that's the exact solution my colleague just had. Seems like this might be the same issue we are having reported earlier |
Exactly! Seems the original creator of this API left the project with some bugs :( |
Based on official docs and other sources I think we need to "ping" in regular intervals...
But how do we do it using slackbots? |
same issues here. i keep restarting stuff |
I am also facing the same issue. Bot getting auto disconnected. Any solution other than restart? Please advice. |
It appears slackbots already does the ping that @mkt1988 suggested?
|
I have been trying to fix this in the past few days. I'm close but not there yet - maybe we can figure this out together! First I created an Incoming WebHook (part 3 of this article) : https://api.slack.com/messaging/webhooks Then I installed this simplified version of the https module :https://www.npmjs.com/package/request#custom-http-headers And I sent a POST request by following the ping/pong format as pointed out by @mkt1988. I tried all sorts of formatting but was still getting 400 res. I even found out the following : So I turned to the https lib because that's the only way I can control what headers are sent : But I'm still getting 400 bad request. I went back to the application settings and I tried the curl. Guess what - even with the example curl I still get a bad request!! (and the curl is incorrect because the header needs to be in double quotes, not single). Any suggestions? Thank you. |
Ok so looks like the hangup is not coming from the WebSocket layer, but the layer on top of that. The WebSocket layer has a ping mechanism, and then Slack also wants a separate ping. So in this issue, the ping is correctly done for WebSockets, but not for Slack. The solution I'm going for myself is - instead of trying to send a message of type For a more silent bot, I think the |
i using this kindda approach too. but it still not working. the bot keep sending me the response based on what interval did i give, but when i try to send a message, it wasnt listening. |
I don't know if this is still relevant, but I fixed this problem by adding to the source code a |
Another solution, could be to add the bot in to a systemd service and just restart it every X hours. An example of how to do this here |
I have been very successful to use this API to create a bot. The only downside is the bot is auto disconnecting after 6 hours or so on my ubuntu server. I have used pm2 and screen to make sure to run 24/7, but it's not working.
Does anyone know how to prevent the bot from auto disconnecting?
The text was updated successfully, but these errors were encountered: