adragan Posted November 16, 2015 Share Posted November 16, 2015 Has anyone an ideea how to push a message from the server to the client browser running a UniGui app ? No Pooling please !. Quote Link to comment Share on other sites More sharing options...
Ron Posted December 11, 2015 Share Posted December 11, 2015 Only way would be websockets then, as far as I can tell... I am going to try socket.io and the various JS websocket libraries until I find a way, as my customer is willing to pay a lot just for me TRYING to make that work, even if I end up with no solution...clearly desperate to get phone caller number showing up in client within 5 seconds after phone central resolves it, so I've set up a REST server using apache to catch the phone central's HTTP GET and then it's going to be interesting to see if Unigui can work with some websocket library...will post my results in some weeks. 1 Quote Link to comment Share on other sites More sharing options...
Harry Rogers Posted December 11, 2015 Share Posted December 11, 2015 This sounds interesting. Look forward to seeing how you get on. Thank you Quote Link to comment Share on other sites More sharing options...
Oliver Morsch Posted December 11, 2015 Share Posted December 11, 2015 Websocket on client side should be simple, using some javascript code you can find everywhere. Only modern browser is needed. For websocket on server side (with Delphi) you can find something here. -> 1st Option: make a separate Server for websocket -> 2nd Option: integrate it in uniGUI Server (I have no idea if this is possible!). So I have used "Long polling" to integrate in uniGUI. This was simple in newer uniGUI versions. Quote Link to comment Share on other sites More sharing options...
adragan Posted December 11, 2015 Author Share Posted December 11, 2015 Thanks everyone. I'll keep you posted. 1 Quote Link to comment Share on other sites More sharing options...
gerhard.kimmeringer Posted January 6, 2016 Share Posted January 6, 2016 I have test it with these components:http://websockets.esegece.com/ The Server is only a component. In Servermodule -Customfiles i add this line:http://127.0.0.1:12345/sgcWebSockets.jsIn Mainform SCRIPT add the script <script>var socket = new sgcWebSocket('ws://127.0.0.1:12345');socket.on('open', function(event) { console.log('OPEN'); });socket.on('close', function(event) { ajaxRequest(MainForm.window,'Closed', []); });socket.on('error', function(event) { ajaxRequest(MainForm.window,event.message, []); });socket.on('message', function(event) { ajaxRequest(MainForm.window,event.message, []); });</script> Now i get the event.message in Mainform OnAjaxEvent Thats all, it works very well, hope it helps. 3 Quote Link to comment Share on other sites More sharing options...
TI.ME Posted December 10, 2018 Share Posted December 10, 2018 On 12/11/2015 at 8:15 AM, Ron said: Only way would be websockets then, as far as I can tell... I am going to try socket.io and the various JS websocket libraries until I find a way, as my customer is willing to pay a lot just for me TRYING to make that work, even if I end up with no solution...clearly desperate to get phone caller number showing up in client within 5 seconds after phone central resolves it, so I've set up a REST server using apache to catch the phone central's HTTP GET and then it's going to be interesting to see if Unigui can work with some websocket library...will post my results in some weeks. This Work!!! Quote Link to comment Share on other sites More sharing options...
Ruslan Posted December 11, 2018 Share Posted December 11, 2018 we need components UniSocketClient and UniSocketServer, the same as in TMS Quote Link to comment Share on other sites More sharing options...
Ron Posted December 13, 2018 Share Posted December 13, 2018 I use a socket.io Javascript client, and a Node server running a socket.io server. The client is set up in a UniHtmlFrame, and also doing authentication using AjaxCallback. It works, and is not that complicated to set up. But native components, client and server, would be nice. Guess the fallback stuff used by socket.io is needed, in case there is no websocket support in the browser - then it uses long polling. Quote Link to comment Share on other sites More sharing options...
FFREDIANELLI Posted December 13, 2018 Share Posted December 13, 2018 Some roadmap to follow or example available ? Thanks in advance. Quote Link to comment Share on other sites More sharing options...
TI.ME Posted December 29, 2018 Share Posted December 29, 2018 Good afternoon!!! http://forums.unigui.com/index.php?/topic/3275-messageserver-push-messages-from-server-to-client-long-polling/ Personally, I have adapted the message server into my project and it works perfect ... However, I moved the installation of my project to HyperServer, and now it does not work !!! When you start the msg screen, it javascript error msg !!! Has anyone ever had this problem ?? Would it help to solve ?? Error Msg <script type="text/javascript">var w=window;var dc=w.document;w.onbeforeunload=null;dc.open();dc.write("\x3Chtml\x3E\n\x3Cbody bgcolor=\"#dfe8f6\"\x3E\n\x3Cp style=\"text-align:center;color:#0000A0\"\x3EInvalid session or session Timeout.\x3C/p\x3E\n\x3Cp style=\"text-align:center;color:#A05050\"\x3E\x3Ca href=\"http://localhost:8077/\"\x3ERestart application\x3C/a\x3E\x3C/p\x3E\n\x3C/body\x3E\n\x3C/html\x3E\n");dc.close();</script> Quote Link to comment Share on other sites More sharing options...
TI.ME Posted January 2, 2019 Share Posted January 2, 2019 On 12/29/2018 at 7:09 PM, TI.ME said: Good afternoon!!! http://forums.unigui.com/index.php?/topic/3275-messageserver-push-messages-from-server-to-client-long-polling/ Personally, I have adapted the message server into my project and it works perfect ... However, I moved the installation of my project to HyperServer, and now it does not work !!! When you start the msg screen, it javascript error msg !!! Has anyone ever had this problem ?? Would it help to solve ?? Error Msg <script type="text/javascript">var w=window;var dc=w.document;w.onbeforeunload=null;dc.open();dc.write("\x3Chtml\x3E\n\x3Cbody bgcolor=\"#dfe8f6\"\x3E\n\x3Cp style=\"text-align:center;color:#0000A0\"\x3EInvalid session or session Timeout.\x3C/p\x3E\n\x3Cp style=\"text-align:center;color:#A05050\"\x3E\x3Ca href=\"http://localhost:8077/\"\x3ERestart application\x3C/a\x3E\x3C/p\x3E\n\x3C/body\x3E\n\x3C/html\x3E\n");dc.close();</script> Good night... Actually it was problem with the port, with the hyperserver, the unigui executable, it does not use the default port configured, the hyperserver determines another port ... I made the correction and everything went back to normal !! Thank you!!! 1 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.