Add read timeout

This commit is contained in:
Tyler 2017-04-24 00:53:55 -04:00
parent ed864deeaf
commit 91cd88b101
1 changed files with 3 additions and 1 deletions

View File

@ -91,6 +91,8 @@ func (t *TwitchPubSub) Open() error {
return err
}
c.SetReadDeadline(45 * time.Second)
t.wsConn = c
t.listening = make(chan interface{})
@ -290,7 +292,7 @@ func (t *TwitchPubSub) reader(wsConn *websocket.Conn, listening <-chan interface
}
func (t *TwitchPubSub) pinger(wsConn *websocket.Conn, listening <-chan interface{}) {
ticker := time.NewTicker(150 * time.Second)
ticker := time.NewTicker(30 * time.Second)
defer ticker.Stop()
for {