From 91cd88b10106272ff2949890f83be81747962f2f Mon Sep 17 00:00:00 2001 From: Tyler Date: Mon, 24 Apr 2017 00:53:55 -0400 Subject: [PATCH] Add read timeout --- pubsub.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pubsub.go b/pubsub.go index 1ca2bf8..626a612 100644 --- a/pubsub.go +++ b/pubsub.go @@ -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 {