RobertoLopes Posted January 22, 2019 Share Posted January 22, 2019 Our application requires that every session do a permanent connection to a Socket server, send commands and receive events in response of this command OR receive messages that are not attached to ANY command (events from our communication server). So, it must read the socket permanently. The usual way to do that is to have one thread for each connection waiting for the messages to arrive. However, on unigui I cannot call ANY component inside the thread (not even a Timer), so, how can I update a visual control on my page when I receive an event from my socket connection ? Is there another solution to do this ? THanks in advance Quote Link to comment Share on other sites More sharing options...
Wilton Ergon Posted January 22, 2019 Share Posted January 22, 2019 use sockets in unigui and a challenge, I have a chat system, which I did not find solution using conventional sockets components. I'm looking for it too Quote Link to comment Share on other sites More sharing options...
Tokay Posted January 22, 2019 Share Posted January 22, 2019 This is one of the pain of the components. Solutions exists, but all are worst. I try to find hardly how to store and get acces later to the UniGUI sessions but without success. It's very strange for me. Quote Link to comment Share on other sites More sharing options...
RobertoLopes Posted January 22, 2019 Author Share Posted January 22, 2019 YE found a way (dirty way) is to have a timer active all time. And a flag (statusChanged variable) and a change this variable as soon as I receive a message form my socket. It works but as I say, it's dirty ! Quote Link to comment Share on other sites More sharing options...
RobertoLopes Posted July 16, 2019 Author Share Posted July 16, 2019 So. I'm still annoyed why this is not possible. It means I cannot create a multi-thread component for Unigui ? Do we have some other way ? I'm using my "dirty" way but it's really painful and ugly. Quote Link to comment Share on other sites More sharing options...
RobertoLopes Posted January 2, 2020 Author Share Posted January 2, 2020 NOt any clues yet ? Timers are really not the best way to "wait for asynchronous events" Quote Link to comment Share on other sites More sharing options...
Hayri ASLAN Posted January 2, 2020 Share Posted January 2, 2020 To able to update the client-side, you have to get an event from the client. In your case, you are making a change in the server-side but you need to get an event to make these changes in the client-side. Timer is creating an event for you. Quote Link to comment Share on other sites More sharing options...
RobertoLopes Posted January 2, 2020 Author Share Posted January 2, 2020 35 minutes ago, Hayri ASLAN said: To able to update the client-side, you have to get an event from the client. In your case, you are making a change in the server-side but you need to get an event to make these changes in the client-side. Timer is creating an event for you. Yes but, there is any way to trigger the event only whem it happens instead of having a timer runnig all the time ? Quote Link to comment Share on other sites More sharing options...
Hayri ASLAN Posted January 2, 2020 Share Posted January 2, 2020 There is no way to send something to the client-side unless you get an event. You can try to use WebSockets. Quote Link to comment Share on other sites More sharing options...
RobertoLopes Posted January 2, 2020 Author Share Posted January 2, 2020 I cannot do something like ajaxRequest from inside my thread to trigger a custom event ? Quote Link to comment Share on other sites More sharing options...
Hayri ASLAN Posted January 2, 2020 Share Posted January 2, 2020 Unfortunately you can not. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.