Skip to content

Commit fbf220d

Browse files
committed
Allow specifying Shard gateway encoding
1 parent 780d67b commit fbf220d

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

  • library/wumpy-gateway/wumpy/gateway

library/wumpy-gateway/wumpy/gateway/shard.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
CloseDiscordConnection, ConnectionRejected, DiscordConnection, Opcode,
1818
should_reconnect
1919
)
20-
from typing_extensions import Self
20+
from typing_extensions import Literal, Self
2121

2222
from .errors import ConnectionClosed
2323
from .utils import DefaultGatewayLimiter, race
@@ -116,10 +116,11 @@ def __init__(
116116
shard_id: Optional[Tuple[int, int]] = None,
117117
*,
118118
max_concurrency: int = 1,
119+
encoding: Literal['json', 'etf'] = 'json',
119120
ratelimiter: Optional[Callable[[int], AsyncContextManager[GatewayLimiter]]] = None,
120121
ssl_context: Optional[ssl.SSLContext] = None
121122
) -> None:
122-
self._conn = DiscordConnection(uri, encoding='json', compress='zlib-stream')
123+
self._conn = DiscordConnection(uri, encoding=encoding, compress='zlib-stream')
123124
self._sock = None
124125
self._ssl = ssl_context
125126

0 commit comments

Comments
 (0)