recws-org / recws

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!

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

After close 1006 reconnection does not happen

vporton opened this issue · comments

After abnormal closure, automatic reconnection does not happen:

2023/07/24 19:26:15 Connected to server:ws://localhost:8081/connect
2023/07/24 19:26:15 websocket read error: websocket: close 1006 (abnormal closure): unexpected EOF
2023/07/24 19:26:15 websocket read error: websocket: not connected
2023/07/24 19:26:15 websocket read error: websocket: not connected
2023/07/24 19:26:15 websocket read error: websocket: not connected
...
	for _, conn := range connections {
		go func(conn *recws.RecConn) {
			for {
			start:
				_, msg, err := conn.ReadMessage()
				if err != nil {
					log.Println("websocket read error:", err)
					continue
				}
			...
			}
		}(conn)
	...

It was a fake alarm, and error in my code, not in the library.