guardWebsocket is called as a gofunction and cannot release unless done is called. But unfortunately, it's closed after the watchdog barks and ends up living forever. Also extend the write lock to the end of startWebsocket as a precaution to ensure new usage of the client does not cause disconnect before it's done setting up the callbacks.
guardWebsocket
is called as a gofunction and cannot release unlessdone
is called. But unfortunately, it's closed after the watchdog barks and ends up living forever. Also extend the write lock to the end of startWebsocket as a precaution to ensure new usage of the client does not cause disconnect before it's done setting up the callbacks.