Add events for sniffing the WebSocket data
Add on_socket_raw_receive and on_socket_raw_send events for sniffing the data being received and sent on the websocket. Useful for debugging and logging websocket messages received and sent on the link to Discord's servers.
This commit is contained in:
@ -93,7 +93,12 @@ class WebSocket(WebSocketBaseClient):
|
||||
def handshake_ok(self):
|
||||
pass
|
||||
|
||||
def send(self, payload, binary=False):
|
||||
self.dispatch('socket_raw_send', payload, binary)
|
||||
WebSocketBaseClient.send(self, payload, binary)
|
||||
|
||||
def received_message(self, msg):
|
||||
self.dispatch('socket_raw_receive', msg)
|
||||
response = json.loads(str(msg))
|
||||
log.debug('WebSocket Event: {}'.format(response))
|
||||
if response.get('op') != 0:
|
||||
|
Reference in New Issue
Block a user