Jump to content

Push Message


adragan

Recommended Posts

  • 4 weeks later...

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.

  • Upvote 1
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

  • 4 weeks later...

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.js

In 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.

  • Upvote 3
Link to comment
Share on other sites

  • 2 years later...
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!!!

 

 

 

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

  • 3 weeks later...
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>

Link to comment
Share on other sites

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!!!

  • Like 1
Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...