Skip to content

Commit

Permalink
feat: define kwargs to be passed along to ws connect
Browse files Browse the repository at this point in the history
  • Loading branch information
edaniszewski committed Jan 11, 2021
1 parent cc54517 commit bca3df2
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions synse/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -616,6 +616,7 @@ def __init__(
port: Optional[int] = 5000,
session: Optional[aiohttp.ClientSession] = None,
loop: Optional[asyncio.AbstractEventLoop] = None,
**connect_kwargs,
) -> None:

self.loop = loop or asyncio.get_event_loop()
Expand All @@ -626,6 +627,7 @@ def __init__(
)

self.connect_url = f'ws://{host}:{port}/{self.api_version}/connect'
self._connect_kwargs = connect_kwargs

# The WebSocket connection to use. This is created when using the WebsocketClient
# as a context manager, or it must be created manually with the `connect` method.
Expand Down Expand Up @@ -687,6 +689,7 @@ async def connect(self):
try:
self._connection = await self.session.ws_connect(
url=self.connect_url,
**self._connect_kwargs,
)
except aiohttp.ClientError as e:
log.error(f'failed to connect to Synse Server websocket endpoint: {e}')
Expand Down

0 comments on commit bca3df2

Please sign in to comment.