You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If there is a network issue an exception is thrown by the websocket library; for code consuming the API it would be convenient to get the task created by AvanzaSocket::init() to receive the socket data - making it possible to wait for and handle possible exceptions together with other tasks (using for example asyncio.gather()), as well as being able to cancel it for a controlled shutdown. Since the init() method does not return the result of asyncio.ensure_future(self.__create_socket()) this requires some extra fiddling in the consuming code, making it sensitive to changes in the API.
async def init(self):
asyncio.ensure_future(self.__create_socket()) # nice if the result of this could be returned at the end of the method
await self.__wait_for_websocket_to_be_connected()
Ideally the actual call to AvanzaSocket::init() should also be wrapped by the Avanza class allowing access without having to go through the _socket member, as - say - Avanza::init_socket() --> return await self._socket.init()
The text was updated successfully, but these errors were encountered:
If there is a network issue an exception is thrown by the websocket library; for code consuming the API it would be convenient to get the task created by AvanzaSocket::init() to receive the socket data - making it possible to wait for and handle possible exceptions together with other tasks (using for example asyncio.gather()), as well as being able to cancel it for a controlled shutdown. Since the init() method does not return the result of asyncio.ensure_future(self.__create_socket()) this requires some extra fiddling in the consuming code, making it sensitive to changes in the API.
Ideally the actual call to AvanzaSocket::init() should also be wrapped by the Avanza class allowing access without having to go through the _socket member, as - say - Avanza::init_socket() --> return await self._socket.init()
The text was updated successfully, but these errors were encountered: