websocket: add write lock when sending

This commit is contained in:
JacobPlaster
2020-01-02 15:52:14 +00:00
committed by Jacob Plaster
parent 7db6b5d73f
commit d54c0d2391
3 changed files with 20 additions and 18 deletions

View File

@@ -54,13 +54,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.socket.ws.send(json.dumps(payload))
await self.socket.send(json.dumps(payload))
async def subscribe(self):
"""
Send a subscription request to the bitfinex socket
"""
await self.socket.ws.send(json.dumps(self._get_send_payload()))
await self.socket.send(json.dumps(self._get_send_payload()))
def confirm_unsubscribe(self):
"""