Deal with server sent event on client side GWT
<p>I need to implement front-end for Server-Sent-Event. I use GWT, and i can not find any solution to create a listener for SSE. I need to push the data from server and to receive it on client every time hen data was changed. So for now i have a something like this:</p>

<pre><code>private void method() {
    final EventSource eventSource = EventSource.newEventSourceIfSupported();
    if (null != eventSource) {
        eventSource.setListener(this);
        eventSource.open(GWT.getHostPageBaseURL() + "rest/myresource");
    }
}

@Override
public void onOpen(EventSource eventSource) {
    Window.alert("Open");

}

@Override
public void onClose(EventSource eventSource) {
    Window.alert("onClose");

}

@Override
public void onMessage(EventSource eventSource, String lastEventId, String type, String data) {
    Window.alert("lastEventId: " + lastEventId);
    Window.alert("type: " + type);
    Window.alert("data: " + data);

}

@Override
public void onError(EventSource eventSource) {
    Window.alert("onError");

}
</code></pre>

<p>my class implements <code>EventSourceListener</code>
But it does not work. Actually this code reacting only when connection is opened, but it is impossible to receive any message from server. Do somebody know how to deal the issue with receiving data on client using GWT?</p>