Disable compression for websockets.
Increase of RAM and CPU doesn't give me much benefit I feel.
This commit is contained in:
parent
e51f92e78d
commit
5ae9ea26b1
@ -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
|
||||
|
@ -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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user