mercredi 6 juillet 2016

Python Autobahn - Where do you write the logic to broad a signal?


I'm currently working with the Autobahn Python library. I'm attempting to set up a websocket server that broadcasts a signal to connected clients. However, I'm struggling to understand where I should place the logic for actually broadcasting the signal.

When defining the WebSocketProtocol, it appears that it only describes what should happen during client-driven events (e.g. respond with 'Hello World' when client sends server a message).

However, I'm more interested in creating a server that sends messages without a client asking for data. After all, wasn't this the main reason websockets were developed?

So my question: Where do you implement the 'send message' logic for an Autobahn websocket server if it is not associated with a client event? I'm thinking of broadcasting messages from the server every 5 seconds. I can not seem to find any documentation on Autobahn's website regarding this.

Thank you!


Aucun commentaire:

Enregistrer un commentaire