automatically refresh data in web page

117 views
Skip to first unread message

wissam aoufan

unread,
May 9, 2020, 6:35:08 AM5/9/20
to GWT Users
Hi,

I'm using GWT and I want to know what's the best way of refreshing data push it to a webpagge automatically i.e. when data is inserted in my database, i want to push it to the browser.

Thanks.


Wissam

Marteijn Nouwens

unread,
May 9, 2020, 9:24:10 AM5/9/20
to GWT Users
I recently asked the same question and was advides to use web socket from elemental2.

The doc not not good but it;s not hard to figure it out.

If you need pointer i can help.

Marteijn


Op zaterdag 9 mei 2020 12:35:08 UTC+2 schreef wissam aoufan:

Thomas Broyer

unread,
May 9, 2020, 11:25:18 AM5/9/20
to GWT Users
Fwiw, WebSocket is for bidirectional communication. Have a look at Server-Sent Events (aka EventSource), https://caniuse.com/#feat=eventsource, it might be easier to integrate in your server stack (it's HTTP, whereas WebSocket is a whole different protocol that needs support at the web server level as well as all reverse-proxies)

Marteijn Nouwens

unread,
May 10, 2020, 10:42:37 AM5/10/20
to GWT Users
Hi Thomas

For my information. What would you use on the gwt side for EventSource.

Marteijn

Op zaterdag 9 mei 2020 17:25:18 UTC+2 schreef Thomas Broyer:

Thomas Broyer

unread,
May 11, 2020, 6:45:13 AM5/11/20
to GWT Users


On Sunday, May 10, 2020 at 4:42:37 PM UTC+2, Marteijn Nouwens wrote:
Hi Thomas

For my information. What would you use on the gwt side for EventSource.

elemental2-dom? or hand-written JsInterop, as the API is really small: https://html.spec.whatwg.org/multipage/server-sent-events.html#eventsource

Alexander Leshkin

unread,
May 11, 2020, 11:26:57 AM5/11/20
to GWT Users


Very simple examples, but may be usefull as starting point. And examples contains both, client and server code in one project, but this is not recommended due to leaking GWT dev-dependencies into server classpath.
Reply all
Reply to author
Forward
0 new messages