Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion td/stream.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@

import websockets

from websockets.extensions.permessage_deflate import ClientPerMessageDeflateFactory

from td.enums import CSV_FIELD_KEYS
from td.enums import CSV_FIELD_KEYS_LEVEL_2
from td.enums import STREAM_FIELD_IDS
Expand Down Expand Up @@ -56,6 +58,7 @@ def __init__(self, websocket_url: str, user_principal_data: dict, credentials: d
"""

self.websocket_url = "wss://{}/ws".format(websocket_url)
self.websocket_args = {"extensions": [ClientPerMessageDeflateFactory()]}
self.credentials = credentials
self.user_principal_data = user_principal_data
self.connection: websockets.WebSocketClientProtocol = None
Expand Down Expand Up @@ -628,7 +631,7 @@ async def _connect(self) -> websockets.WebSocketClientProtocol:
login_request = self._build_login_request()

# Create a connection.
self.connection = await websockets.client.connect(self.websocket_url)
self.connection = await websockets.connect(self.websocket_url, **self.websocket_args)

# See if we are connected.
is_connected = await self._check_connection()
Expand Down