Skip to content

Commit

Permalink
fix: remove ping text from sendPing instead of binary
Browse files Browse the repository at this point in the history
  • Loading branch information
ranjanrak committed Feb 7, 2024
1 parent 9cb66b1 commit ce72bd7
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions kiteconnect/ticker.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ class KiteTickerClientProtocol(WebSocketClientProtocol):
PING_INTERVAL = 2.5
KEEPALIVE_INTERVAL = 5

_ping_message = ""
_next_ping = None
_next_pong_check = None
_last_pong_time = None
Expand Down Expand Up @@ -107,14 +106,13 @@ def onPong(self, response): # noqa
def _loop_ping(self): # noqa
"""Start a ping loop where it sends ping message every X seconds."""
if self.factory.debug:
log.debug("ping => {}".format(self._ping_message))
if self._last_ping_time:
log.debug("last ping was {} seconds back.".format(time.time() - self._last_ping_time))

# Set current time as last ping time
self._last_ping_time = time.time()
# Send a ping message to server
self.sendPing(self._ping_message)
self.sendPing()

# Call self after X seconds
self._next_ping = self.factory.reactor.callLater(self.PING_INTERVAL, self._loop_ping)
Expand Down

0 comments on commit ce72bd7

Please sign in to comment.