Skip to content

Commit

Permalink
Fix for an immediate issue (#51)
Browse files Browse the repository at this point in the history
  • Loading branch information
enrh authored Sep 27, 2024
1 parent 3e3262e commit 3bdbf8e
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions enconnect/mattermost/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
from typing import Optional
from typing import TYPE_CHECKING

from encommon.times import Timer
from encommon.types import DictStrAny
from encommon.types import NCNone
from encommon.types import sort_dict
Expand All @@ -36,6 +37,12 @@



PING = {
'action': 'ping',
'seq': 1}



class Client:
"""
Establish and maintain connection with the chat service.
Expand Down Expand Up @@ -210,6 +217,10 @@ def __operate(
assert socket is not None


timer = Timer(
30, start='min')


self.__identify()


Expand All @@ -221,6 +232,13 @@ def __operate(
if receive is not None:
self.__event(receive)

if timer.pause():
continue # NOCVR

logger(item='ping')

self.socket_send(PING)


logger(item='close')

Expand Down

0 comments on commit 3bdbf8e

Please sign in to comment.