Fixing error where connection was re-established incorrectly

This commit is contained in:
watsonb8 committed 2023-09-26 13:02:10 -05:00
1 parent 896bafe70b
commit b375ab3c8c
2 files changed
+13

No files matched your search

+9
View File
@@ -113,12 +113,21 @@ func (d *Dispatcher) dispatchMessage(msg *message.Message) {
return
}
log.Println("Websocket terminated: reconnecting")
err := d.Disconnect()
if err != nil {
log.Println(err)
}
d.Connect()
if err != nil {
log.Println(err)
}
subsList := d.store.GetAll()
for i := range subsList {
sub := subsList[i]
d.Subscribe(sub.Name(), sub.AuthToken())
}
return
case message.MetaSubscribe:
//handle MetaSubscribe resp
d.pendingSubsMu.Lock()