Properly lock before the close check

This commit is contained in:
Tyler 2017-11-28 19:59:56 -05:00
parent aa699f02a0
commit 7dd180eb83
1 changed files with 2 additions and 0 deletions

View File

@ -118,6 +118,8 @@ func (t *TwitchPubSub) Close() error {
t.listening = nil
}
t.Lock()
if t.wsConn != nil {
// To cleanly close a connection, a client should send a close
// frame and wait for the server to close the connection.