From 023e0eb1d5df5ade0ce5f0350b09e10500077d0e Mon Sep 17 00:00:00 2001 From: Hornwitser Date: Fri, 16 Oct 2015 14:16:17 +0200 Subject: [PATCH] Use compact encoding for json on websocket Remove extra whitespace from json encoding used when sending messages on the websocket. --- discord/client.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/discord/client.py b/discord/client.py index 5d29de7eb..f4f473a42 100644 --- a/discord/client.py +++ b/discord/client.py @@ -70,7 +70,7 @@ class KeepAliveHandler(threading.Thread): msg = 'Keeping websocket alive with timestamp {0}' log.debug(msg.format(payload['d'])) - self.socket.send(json.dumps(payload)) + self.socket.send(json.dumps(payload, separators=(',', ':'))) class WebSocket(WebSocketBaseClient): def __init__(self, dispatch, url): @@ -436,7 +436,7 @@ class Client(object): } } - self.ws.send(json.dumps(second_payload)) + self.ws.send(json.dumps(second_payload, separators=(',', ':'))) def _resolve_mentions(self, content, mentions): if isinstance(mentions, list):