diff options
| author | Rapptz <[email protected]> | 2018-06-10 18:37:51 -0400 |
|---|---|---|
| committer | Rapptz <[email protected]> | 2018-06-10 18:37:51 -0400 |
| commit | 5ae9ea26b176b4368b7887b70e3e0416405b4ace (patch) | |
| tree | 2101078d6e1327be469c75bda54452bdb34db023 | |
| parent | Fix NameError for typing context manager. (diff) | |
| download | discord.py-5ae9ea26b176b4368b7887b70e3e0416405b4ace.tar.xz discord.py-5ae9ea26b176b4368b7887b70e3e0416405b4ace.zip | |
Disable compression for websockets.
Increase of RAM and CPU doesn't give me much benefit I feel.
| -rw-r--r-- | discord/gateway.py | 4 | ||||
| -rw-r--r-- | discord/shard.py | 2 |
2 files changed, 3 insertions, 3 deletions
diff --git a/discord/gateway.py b/discord/gateway.py index 0b54c1d2..db5809b6 100644 --- a/discord/gateway.py +++ b/discord/gateway.py @@ -196,7 +196,7 @@ class DiscordWebSocket(websockets.client.WebSocketClientProtocol): This is for internal use only. """ gateway = await client.http.get_gateway() - ws = await websockets.connect(gateway, loop=client.loop, klass=cls) + ws = await websockets.connect(gateway, loop=client.loop, klass=cls, compression=None) # dynamically add attributes needed ws.token = client.http.token @@ -587,7 +587,7 @@ class DiscordVoiceWebSocket(websockets.client.WebSocketClientProtocol): async def from_client(cls, client, *, resume=False): """Creates a voice websocket for the :class:`VoiceClient`.""" gateway = 'wss://' + client.endpoint + '/?v=3' - ws = await websockets.connect(gateway, loop=client.loop, klass=cls) + ws = await websockets.connect(gateway, loop=client.loop, klass=cls, compression=None) ws.gateway = gateway ws._connection = client ws._max_heartbeat_timeout = 60.0 diff --git a/discord/shard.py b/discord/shard.py index 7a736bfe..8e04b9c5 100644 --- a/discord/shard.py +++ b/discord/shard.py @@ -210,7 +210,7 @@ class AutoShardedClient(Client): async def launch_shard(self, gateway, shard_id): try: - coro = websockets.connect(gateway, loop=self.loop, klass=DiscordWebSocket) + coro = websockets.connect(gateway, loop=self.loop, klass=DiscordWebSocket, compression=None) ws = await asyncio.wait_for(coro, loop=self.loop, timeout=180.0) except Exception as e: log.info('Failed to connect for shard_id: %s. Retrying...', shard_id) |