Hi, I'm currently working on a protocol that uses multiple WebSocket connections, each is used to receive unrelated incoming data.
Since the user only needs the data received on some of the WebSockets, we need to provide a way for the user to enable/disable the WebSocket connection.
Right now I'm using dynamic IP parameters for each connection and when I wish to disable a connection, I set the respective dynamic IP to empty. But this approach causes regular timeouts on the element.
What would then be the best approach to enable/disable WebSocket connections?
Thanks in advance.
Depending on how you are implementing the connection (standard or via QAction), I'd say you can either disable timeouts for the specific connections or use group conditions to not even execute the sessions if the given parameter is set to disabled.
If you are using the standard approach, I can think of two options:
1. New core feature to be able to disable the use of an interface at will
2. Move the implementation to custom code not relying on the core features. I’d say to try this as the last possible option since you lose the power of the core
Hi Rene,
Thanks for the sugestion.
The websocket connection is implemented using the Connections tag.
I disabled timeouts as a workaround, but it didn’t seem natural to me having to do this to prevent having timeouts on connections that I don’t even want to attempt to establish a connection. That’s why I asked for the best approach to disable them.
The group conditions approach won’t work, since websockets will receive incoming messages as soon as they are connected. and the information received does not depend on a session to poll the information.
Kind Regards,