As described in the documentation, there are multiple ways to implement web sockets in a connector:
- Command/Response combined in a pair (similar to serial)
- Command only in a pair with a response on its own where the WebSocket server will send data to (similar to smart-serial)
https://docs.dataminer.services/develop/devguide/Connector/ConnectionsWebSocketsCommunication.html
How does the element timeout behavior work for those implementations?
1) If the websocket is implemented with a command/response pair, will the element timeout be linked to the timeout of single command logic?
2) If the response is not implemented in the pair with the command, will the element ever go into timeout? Or do we need to implement our own timeout logic where we're expecting to receive data in for instance every 60 seconds?
Hi Andries,
In the WebSocket implementation, the connector just needs one response, which will handle all the incoming messages from the product you're trying to connect with, meaning that the element will go into timeout when the server closes the connection for some reason, leaving the web socket open until that moment, as specified in the documentation:
Please feel free to check the Connection WebSocket Implementation for more details.
The WebSocket implementation should not behave in the same way as Smart-Serial, since the WebSocket connection should lead the Element to go into timeout once the server gets disconnected and the timeout time configured at Element Wizard level is reached.
Am I correct that the docs in my question are not up to date for the communication in WebSockets?
The Timeout information in the docs for the WebSocket implementation can indeed be improved, which is a topic that I’m already addressing. Many thanks for the feedback!
Will the behavior in the second question be the same as smart serial? And when will the element go into timeout if we do not use a heartbeat?
https://docs.dataminer.services/develop/devguide/Connector/ConnectionsSmartSerialBehaviorAfterDisconnect.html