recws
recws copied to clipboard
Reconnecting WebSocket is a websocket client based on gorilla/websocket that will automatically reconnect if the connection is dropped and keeps the connection alive - thread safe!
Currently I do it this way, but find it rather unclean: ```go for { if !ws.IsConnected() { time.Sleep(time.Second * 2) continue } // Do stuff with connection } ``` One...
version: v1.3.1 I am also using ``` &recws.RecConn{ KeepAliveTimeout: 60 * time.Second, } ``` It kept reconnecting after the first connection reset, I also couldn't receive new messages afterwards. 
Code (from example, but use ws rather than wss) The server is a raw ws nodejs app, working perfectly with a golang client using gorilla websocket. ``` package main import...
https://github.com/recws-org/recws/blob/28f1b9c2e91c3a7a5d5561e6956eac823f7fedf8/recws.go#L289 Seems arbitrary and pointless?
Fix example for more correct read. Current example stops reading on errors, but continue reconnect and always disconnects with keepalive. Fixes https://github.com/recws-org/recws/issues/38
Was playing around with this lib trying to have a fault tolerant ws connection. Tried patches from different prs and forks, still there was a present problem with race -...
Fixed #20