From a55246eb77b2506c329df9df65f8ea2a3e93290b Mon Sep 17 00:00:00 2001 From: nanoric Date: Mon, 15 Oct 2018 04:29:39 -0400 Subject: [PATCH] =?UTF-8?q?[Mod]=20WebSocketClient.onMessage=E6=94=B9?= =?UTF-8?q?=E5=90=8D=E4=B8=BAonPacket=EF=BC=8C=E4=BB=A5=E5=85=8D=E5=92=8C?= =?UTF-8?q?=E6=AD=A3=E5=B8=B8WebSocket=E7=9A=84onMessage=E6=90=9E=E6=B7=B7?= =?UTF-8?q?=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tests/api/base/WebSocketClientTest.py | 2 +- vnpy/api/websocket/WebSocketClient.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/api/base/WebSocketClientTest.py b/tests/api/base/WebSocketClientTest.py index 0592f2c1..9f5d3da8 100644 --- a/tests/api/base/WebSocketClientTest.py +++ b/tests/api/base/WebSocketClientTest.py @@ -13,7 +13,7 @@ class TestWebsocketClient(WebsocketClient): self.init(host) self.p = Promise() - def onMessage(self, packet): + def onPacket(self, packet): self.p.set_result(packet) pass diff --git a/vnpy/api/websocket/WebSocketClient.py b/vnpy/api/websocket/WebSocketClient.py index 0726e13b..f1dee894 100644 --- a/vnpy/api/websocket/WebSocketClient.py +++ b/vnpy/api/websocket/WebSocketClient.py @@ -109,7 +109,7 @@ class WebsocketClient(object): continue data = json.loads(stream) - self.onMessage(data) + self.onPacket(data) except: et, ev, tb = sys.exc_info() self.onError(et, ev, tb) @@ -135,7 +135,7 @@ class WebsocketClient(object): #---------------------------------------------------------------------- @abstractmethod - def onMessage(self, packet): + def onPacket(self, packet): """ 数据回调。 只有在数据为json包的时候才会触发这个回调