mirror of https://gitlab.com/litecord/litecord.git
gateway.websocket: add ZstdCompressor at start
This commit is contained in:
parent
9142e26152
commit
59f3f6bbb7
|
|
@ -25,6 +25,7 @@ from typing import List, Dict, Any
|
||||||
from random import randint
|
from random import randint
|
||||||
|
|
||||||
import websockets
|
import websockets
|
||||||
|
import zstandard as zstd
|
||||||
from logbook import Logger
|
from logbook import Logger
|
||||||
|
|
||||||
from litecord.auth import raw_token_check
|
from litecord.auth import raw_token_check
|
||||||
|
|
@ -53,7 +54,7 @@ from litecord.storage import int_
|
||||||
log = Logger(__name__)
|
log = Logger(__name__)
|
||||||
|
|
||||||
WebsocketProperties = collections.namedtuple(
|
WebsocketProperties = collections.namedtuple(
|
||||||
'WebsocketProperties', 'v encoding compress zctx tasks'
|
'WebsocketProperties', 'v encoding compress zctx zsctx tasks'
|
||||||
)
|
)
|
||||||
|
|
||||||
WebsocketObjects = collections.namedtuple(
|
WebsocketObjects = collections.namedtuple(
|
||||||
|
|
@ -80,11 +81,14 @@ class GatewayWebsocket:
|
||||||
self.presence = self.ext.presence
|
self.presence = self.ext.presence
|
||||||
self.ws = ws
|
self.ws = ws
|
||||||
|
|
||||||
self.wsp = WebsocketProperties(kwargs.get('v'),
|
self.wsp = WebsocketProperties(
|
||||||
kwargs.get('encoding', 'json'),
|
kwargs.get('v'),
|
||||||
kwargs.get('compress', None),
|
kwargs.get('encoding', 'json'),
|
||||||
zlib.compressobj(),
|
kwargs.get('compress', None),
|
||||||
{})
|
zlib.compressobj(),
|
||||||
|
zstd.ZstdCompressor(),
|
||||||
|
{}
|
||||||
|
)
|
||||||
|
|
||||||
log.debug('websocket properties: {!r}', self.wsp)
|
log.debug('websocket properties: {!r}', self.wsp)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue