[Mod]change ping-pong of HuobiGateway

This commit is contained in:
vn.py 2019-04-18 14:59:39 +08:00
parent bd36646036
commit 7e9b853d83

View File

@ -507,7 +507,14 @@ class HuobiWebsocketApiBase(WebsocketClient):
def on_packet(self, packet): def on_packet(self, packet):
"""""" """"""
if "ping" in packet: if "ping" in packet:
self.send_packet({"pong": packet["ping"]}) req = {"pong": packet["ping"]}
self.send_packet(req)
elif "op" in packet and packet["op"] == "ping":
req = {
"op": "pong",
"ts": packet["ts"]
}
self.send_packet(req)
elif "err-msg" in packet: elif "err-msg" in packet:
return self.on_error_msg(packet) return self.on_error_msg(packet)
elif "op" in packet and packet["op"] == "auth": elif "op" in packet and packet["op"] == "auth":