[Mod] WebSocketClient.onMessage改名为onPacket,以免和正常WebSocket的onMessage搞混。

This commit is contained in:
nanoric 2018-10-15 04:29:39 -04:00
parent 66cb55ef26
commit a55246eb77
2 changed files with 3 additions and 3 deletions

View File

@ -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

View File

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