I’m trying to play a bit with crossbar/autobahn and I’m having problems trying to use code already existing with autobahn.
When I look the examples documentation, it seems the code is always written “for autobahn”. What I mean here is, it sound like the code is always looking something like that:
(...) onJoin(self, details): do thing def function_interesting(details=None): do the thing I really need def other_interesting(details=None): do other things I need....
If there is other ways to use autobahn, I did not found it (until now).
What I was looking for was a way to use already existing code (i.e an async protocol, a library or something else) to interact with autobahn. In example, I’ve got a protocol to read and decode serial data (not like the twisted example in autobahn), what I want to do is:
def data_received(self, data): parse_mydata(data) call something here to send data with authobahn, using an existing ApplicationSession instance <---- missing part
Until now, I’ve tried a lot of things (nothing working), my best hope was using asyncio.queue, in the protocol, I do a queue.put_nowait(data), and in the onJoin:
async def onJoin(self, details):
while True: value = await myqueue.get() <---- sounds like not working since next line is never called print(value)
What is the proper way to do things like that without implementing all the logic inside the ApplicationSession ?
If things are not clear and you have an interest in this, I’ve put my code here: https://github.com/potens1/solar . I know is not pretty code and some things annoy me a lot (i.e the way to start an event loop and run a Runner)
I’m sorry if this is a noob question, but I tried that on a big part of my weekend without any success (and I guess I miss something important), so, if you have clue or example…