RealTime communication

216 views
Skip to first unread message

Frank

unread,
Oct 4, 2019, 9:35:16 AM10/4/19
to GWT Users
What is the best/easiest way to do realtime communication today in 2019 ?

In the past we have been using SignalR. But SignalR sometimes goes crazy and sends thousands of messages per second. And we don't know how to fix it.


What we need to do is :

- From a GWT app send a message to all other GWT apps currently online (or send it to the server, which sends it to all connected GWT apps).
- From the server, send a message to all GWT apps
- Send a message from a .NET desktop application to all GWT apps (or send it to the server, which sends it to all connected GWT apps).
- The server is also written in .NET



I was thinking about just bare bones websockets. Since this is most the metal and you best now what is going around... 
Any hints where to look on how to work with WebSockets in GWT ? Which library to use ?

Or is WebSockets not a good idea in this case ?

Peter Donald

unread,
Oct 4, 2019, 6:08:42 PM10/4/19
to google-we...@googlegroups.com
On Fri, 4 Oct 2019 at 23:35, Frank <frank....@gmail.com> wrote:
I was thinking about just bare bones websockets. Since this is most the metal and you best now what is going around... 
Any hints where to look on how to work with WebSockets in GWT ? Which library to use ?

We use web sockets for this use case and it works great. We already had our own reconnect-on-drop logic and a serialization layer so found there’s no real value in higher level abstractions 

We have dropped all custom websocket libraries and use a recent elemental2 version and find that fine. (The original elemental2 version was not mapped correctly)

--
Cheers,

Peter Donald

Frank

unread,
Oct 7, 2019, 4:45:45 AM10/7/19
to GWT Users
Do you know where I can find any documentation about how to use websockets with Elemental 2 ?

Peter Donald

unread,
Oct 7, 2019, 6:18:40 AM10/7/19
to GWT Mailing List
Elemental2 is just the browsers API so pretty much any javascript example will work. As a matter of fact, I always used to annoy/delight some of my colleagues by taking an ES6 example and search replacing "const" with "var", "let" with "var" and "=>" with "->" and you would be amazed how often this produced workable code after a few autoimport fixes.

Anyhoo ... something like the following will work although I have not compiled or tested this ... it is just a translation of a javascript example ;).

final WebSocket socket = new WebSocket( "wss://echo.websocket.org/" );

socket.onopen = e -> {
DomGlobal.console.log( "[open] Connection established" );
socket.send( Global.JSON.stringify( JsPropertyMap.of( "message","Hi ho Silver!" ) ) );
};
socket.onerror = e -> DomGlobal.console.log( "[error]", e );
socket.onmessage = e -> DomGlobal.console.log( "[message] Data received from server: ", e.data );
socket.onclose = e -> {
if ( e.wasClean )
{
DomGlobal.console.log( "[close] Connection closed cleanly, code=" + e.code + " reason=" + e.reason + "" );
}
else
{
// e.g. server process killed or network down
// event.code is usually 1006 in this case
DomGlobal.console.log( "[close] Connection died" );
}
};

On Mon, Oct 7, 2019 at 7:46 PM Frank <frank....@gmail.com> wrote:
Do you know where I can find any documentation about how to use websockets with Elemental 2 ?

--
You received this message because you are subscribed to the Google Groups "GWT Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-tool...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-web-toolkit/0ec9d2a0-90df-4653-8cbc-8256d98b0948%40googlegroups.com.


--
Cheers,

Peter Donald
Reply all
Reply to author
Forward
0 new messages