Reconnect on session removal (mattermost)

This commit is contained in:
Wim 2017-04-07 23:25:42 +02:00
parent bd38319d83
commit 89c66b9430
2 changed files with 3 additions and 0 deletions

View File

@ -72,6 +72,7 @@ func (b *Bmattermost) Connect() error {
flog.Info("Connection succeeded")
b.TeamId = b.mc.GetTeamId()
go b.mc.WsReceiver()
go b.mc.StatusLoop()
}
go b.handleMatter()
return nil

View File

@ -178,6 +178,7 @@ func (m *MMClient) Login() error {
}
b.Reset()
m.log.Debug("WsClient: connected")
m.WsSequence = 1
m.WsPingChan = make(chan *model.WebSocketResponse)
// only start to parse WS messages when login is completely done
@ -630,6 +631,7 @@ func (m *MMClient) StatusLoop() {
m.Logout()
m.WsQuit = false
m.Login()
go m.WsReceiver()
}
}
time.Sleep(time.Second * 60)