Open robiwano opened 3 years ago
Meanwhile I'll follow the suggestion to have a publish/subscribe proxy.
Hello @robiwano Did you solve the problem, and if so how? I saw that this library provides a function called _disconnect().
Unfortunately not.
adding this function to the socket and then calling it from Avanza class with a wrapper method should do the trick:
async def __socket_unsubscribe(
self,
subscription_string
):
await self.__send({
'channel': '/meta/unsubscribe',
'clientId': self._client_id,
'subscription': subscription_string
})
I haven't tested this yet but that is how fhqvist is doing it in his javascript wrapper.
I'm not all that up to speed with async in Python and I haven't had time to really test it but I've created a draft with the functionality added if any of you could try it out and reiterate upon it if needed.
It seems it's not possible to cancel a avanza.subscription_id. The following code shows this. Idea is that task is created with ensure_future, and then cancelled after ten seconds. The subscription data continues to pour in after this.