mirror of
https://github.com/Rapptz/discord.py.git
synced 2026-11-20 13:29:03 +00:00
Add Client.latency, AutoShardedClient.latency and latencies.
This should allow an easier way to query the Discord protocol gateway latency, defined by the difference HEARTBEAT_ACK between and the last sent HEARTBEAT.
This commit is contained in:
1 parent
63231ef033
commit
0f7482ed6e
3 files changed
+29
No files matched your search
@@ -346,6 +346,8 @@ class DiscordWebSocket(websockets.client.WebSocketClientProtocol):
|
||||
if op == self.HELLO:
|
||||
interval = data['heartbeat_interval'] / 1000.0
|
||||
self._keep_alive = KeepAliveHandler(ws=self, interval=interval, shard_id=self.shard_id)
|
||||
# send a heartbeat immediately
|
||||
yield from self.send_as_json(self._keep_alive.get_payload())
|
||||
self._keep_alive.start()
|
||||
return
|
||||
|
||||
|
||||
Reference in new issue
Block a user