I'm working on a project where I send msg from uibuilder node over MQTT with epoctime msgid and I want to wait to receive Acknowledge with same msgid over MQTT and affect this session (by socketid) of UI depending on this Acknowledge
How to do that with uibuilder???
The question may seem not understandable but I tried to describe the situation the best I could
Hi. You cannot really rely on the socket id since it changes rather easily. If a user reloads a page, a new id is generated. Similarly if there is an interruption to the websocket connection, a new id will be created.
So really you need to pass an identifier of your own between the client and the server. In the next release of uibuilder, there will be some features to handle that relatively securely and will define some standards for handling user information. You can try that out by installing the security
branch of uibuilder from GitHub if you are feeling a little adventurous. It should work OK, I'm using myself now. I just haven't had time to finish off and test the release unfortunately.
Otherwise, simply decide on a standard data schema that you will exchange between Node-RED and your front end.
Think of it rather like managing a session in a web server/web browser dialogue. But instead of being able to use http headers and/or cookies, you have to exchange everything via the socket.
This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.