Skip to content

Fix WS reconnect ticker

Compare
Choose a tag to compare
@dirname dirname released this 17 Apr 13:41
· 50 commits to main since this release
func (w *WebsocketClient) connectWebsocket() {
	var err error
	url := fmt.Sprintf("wss://%s%s", w.host, w.stream)
	logger.Debug("Start connecting %s...", url)
	w.conn, _, err = websocket.DefaultDialer.Dial(url, nil)
	if err != nil {
		logger.Error("Websocket connection error: %s", err.Error())
		return
	}
	logger.Info("%s connected", url)
	w.lastReceivedTime = time.Now()
	w.establishmentTime = time.Now()
	w.startReadLoop()
	if w.connectedHandler != nil {
		w.connectedHandler()
	}
}