mirror of
https://github.com/aljazceru/bitfinex-api-py.git
synced 2025-12-19 14:54:21 +01:00
genericWebsocket: add reconnect attempt on disconnect
This commit is contained in:
committed by
Jacob Plaster
parent
6e4012f3c1
commit
3c8c3fb71e
@@ -13,8 +13,8 @@ class Subscription:
|
||||
such as unsibscribe and subscribe.
|
||||
"""
|
||||
|
||||
def __init__(self, ws, channel_name, symbol, timeframe=None, **kwargs):
|
||||
self._ws = ws
|
||||
def __init__(self, bfxapi, channel_name, symbol, timeframe=None, **kwargs):
|
||||
self.bfxapi = bfxapi
|
||||
self.channel_name = channel_name
|
||||
self.symbol = symbol
|
||||
self.timeframe = timeframe
|
||||
@@ -40,13 +40,13 @@ class Subscription:
|
||||
if not self.is_subscribed():
|
||||
raise Exception("Subscription is not subscribed to websocket")
|
||||
payload = {'event': 'unsubscribe', 'chanId': self.chan_id}
|
||||
await self._ws.send(json.dumps(payload))
|
||||
await self.bfxapi.get_ws().send(json.dumps(payload))
|
||||
|
||||
async def subscribe(self):
|
||||
"""
|
||||
Send a subscription request to the bitfinex socket
|
||||
"""
|
||||
await self._ws.send(json.dumps(self._get_send_payload()))
|
||||
await self.bfxapi.get_ws().send(json.dumps(self._get_send_payload()))
|
||||
|
||||
def confirm_unsubscribe(self):
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user