chrisgillis / slackwolf

A slack bot that moderates Werewolf games
342 stars 68 forks source link

Check Liveness of Websocket #74

Closed owena11 closed 5 years ago

owena11 commented 5 years ago

We've experienced the bot going offline randomly without producing any output, or throwing any exceptions. My best guess as to why this is happening is Slack closing the websocket used for communication on their end after it has been idle for a given period of time.

However since implementing the test for liveness of the websocket I have been unable to reproduce the bug, as there is a constant small amount of activity over the websocket event when the bot is idle.

This pull request implements the following :

Some of this functionality seems suited to the underlying libraries, but as they are no longer actively maintained I've put the functionality in the existing subclass SlackRTMClient. My PhP isn't exactly my first language so any comments on how this would more conventionally done would be greatly appreciated!

chrisgillis commented 5 years ago

Thank you for contributing. I'm a little surprised the underlying library isn't handling liveliness, but your implementation looks good to me.