Closed melardev closed 1 year ago
By the way, this indirection may seem unnecessary, but actually, the App class in my project does not even know the shape of the WebSocket subscribe message, here it does to keep it simple. I used to have another abstraction layer on top of the AutobahnWsClient and that's what the App has a reference to, it is what actually knows how WebSocket messages look like, the App is only notified when data (after decoding and formatting it by the abstraction layer) is available, this "architecture" is very common and that's the thing I want to do.
Autobahn already is non-blocking, so you don't have to do anything extra, just use it. Or fork it!
Autobahn already is non-blocking, so you don't have to do anything extra, just use it. Or fork it!
Hi. Yes I know, what I am trying to say is if someone could help me figure out some way of using autobahn to get my question done, please. It is not anything very complex and specific to my app it is just a general concept that I think many would benefit from too.
the reason is that I don't want my app to be tied to a web socket framework, I could swap one framework by the other just replacing the implementation
tbh, I don't believe it makes sense or is a well-defined goal, but in general, I'd have a look at the "sans IO" approach https://sans-io.readthedocs.io/
Hi, I have an issue that is taking me some time, it is basic but I could not find any example addressing it.
In my app I wrapped the autobahn code around a class(let's call it AutobahnWsClient) which in turn implements an interface(let's call it IWSLayer), the reason is that I don't want my app to be tied to a web socket framework, I could swap one framework by the other just replacing the implementation. The consumer of the wrapper class, should not know about asyncio, autobahn and of course not even main app logic, it should just do networking stuff. In all examples, the main logic is in the client itself, which is in my case not ideal. And so I need to be able to connect to the websocket but without blocking, I need to give the execution of the code back to the consumer,
how do I do it? The only option I see is using threads which I believe is not that right. Also, I read in #1416 and it indicates the connections must be opened in the same thread. My code however seems to work, perhaps that reply is outdated and no longer applicable?
Is there a "more idiomatic" way of achieving this, please?