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包的时候才会触发这个回调