aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRapptz <[email protected]>2016-07-30 13:03:22 -0400
committerRapptz <[email protected]>2016-07-30 13:03:22 -0400
commit0c95edab8c471d9d9b282cbcee95c7530c776af9 (patch)
tree0ad113fdd50e4d11239d835e5536bd8e7cad516f
parentAdd functions to query and actually prune members from a server. (diff)
downloaddiscord.py-0c95edab8c471d9d9b282cbcee95c7530c776af9.tar.xz
discord.py-0c95edab8c471d9d9b282cbcee95c7530c776af9.zip
Handle receiving HEARTBEAT opcode.
-rw-r--r--discord/gateway.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/discord/gateway.py b/discord/gateway.py
index 56e4ba6f..afc622bf 100644
--- a/discord/gateway.py
+++ b/discord/gateway.py
@@ -303,6 +303,11 @@ class DiscordWebSocket(websockets.client.WebSocketClientProtocol):
if op == self.HEARTBEAT_ACK:
return # disable noisy logging for now
+ if op == self.HEARTBEAT:
+ beat = self._keep_alive.get_payload()
+ yield from self.send_as_json(beat)
+ return
+
if op == self.HELLO:
interval = data['heartbeat_interval'] / 1000.0
self._keep_alive = KeepAliveHandler(ws=self, interval=interval)