commit e92e8f299072578fb8e796180706dc64e8cc8885
Author: Wim <wim@42.be>
Date: Sat Oct 27 22:03:41 2018 +0000
diff --git a/matterclient/matterclient.go b/matterclient/matterclient.go
index 8b3c07d..5a173fe 100644
--- a/matterclient/matterclient.go
+++ b/matterclient/matterclient.go
@@ -63913 +63915 @@ func (m *MMClient) UpdateChannelHeader(channelId string, header string) {
}
}
-func (m *MMClient) UpdateLastViewed(channelId string) {
+func (m *MMClient) UpdateLastViewed(channelId string) error {
m.log.Debugf("posting lastview %#v", channelId)
view := &model.ChannelView{ChannelId: channelId}
_, resp := m.Client.ViewChannel(m.User.Id, view)
if resp.Error != nil {
m.log.Errorf("ChannelView update for %s failed: %s", channelId, resp.Error)
+ return resp.Error
}
+ return nil
}
func (m *MMClient) UpdateUserNick(nick string) error {
@@ -8968 +8987 @@ func (m *MMClient) StatusLoop() {
return
}
if m.WsConnected {
- m.log.Debug("WS PING")
- m.sendWSRequest("ping", nil)
+ m.checkAlive()
select {
case <-m.WsPingChan:
m.log.Debug("WS PONG received")
@@ -9726 +97316 @@ func (m *MMClient) initUser() error {
return nil
}
+func (m *MMClient) checkAlive() error {
+ // check if session still is valid
+ _, resp := m.Client.GetMe("")
+ if resp.Error != nil {
+ return resp.Error
+ }
+ m.log.Debug("WS PING")
+ return m.sendWSRequest("ping", nil)
+}
+
func (m *MMClient) sendWSRequest(action string, data map[string]interface{}) error {
req := &model.WebSocketRequest{}
req.Seq = m.WsSequence