diff options
author | Wim <wim@42.be> | 2020-08-09 21:46:03 +0200 |
---|---|---|
committer | Wim <wim@42.be> | 2020-08-09 21:46:45 +0200 |
commit | dfdffa0027334e55ce213fc6eb62206dbf48baf6 (patch) | |
tree | 049d684514b00e289290c7a63ee91da9f8ebb679 /matterclient/matterclient.go | |
parent | ebd2073144137b1c2ecd6727d67f608cdb0138aa (diff) | |
download | matterbridge-msglm-dfdffa0027334e55ce213fc6eb62206dbf48baf6.tar.gz matterbridge-msglm-dfdffa0027334e55ce213fc6eb62206dbf48baf6.tar.bz2 matterbridge-msglm-dfdffa0027334e55ce213fc6eb62206dbf48baf6.zip |
Add EnableAllEvents
Add option to have all events send to the messagechan
Diffstat (limited to 'matterclient/matterclient.go')
-rw-r--r-- | matterclient/matterclient.go | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/matterclient/matterclient.go b/matterclient/matterclient.go index 338f86d7..35d620c3 100644 --- a/matterclient/matterclient.go +++ b/matterclient/matterclient.go @@ -69,6 +69,7 @@ type MMClient struct { logger *logrus.Entry rootLogger *logrus.Logger lruCache *lru.Cache + allevents bool } // New will instantiate a new Matterclient with the specified login details without connecting. @@ -119,6 +120,10 @@ func (m *MMClient) SetLogLevel(level string) { } } +func (m *MMClient) EnableAllEvents() { + m.allevents = true +} + // Login tries to connect the client with the loging details with which it was initialized. func (m *MMClient) Login() error { // check if this is a first connect or a reconnection @@ -220,6 +225,10 @@ func (m *MMClient) WsReceiver() { continue } } + if m.allevents { + m.MessageChan <- msg + continue + } switch msg.Raw.Event { case model.WEBSOCKET_EVENT_USER_ADDED, model.WEBSOCKET_EVENT_USER_REMOVED, |