Reputation: 703
I'm looking for a way to use websockets in GWT. There are some APIs but i heard that they don't work in developement mode. Is that right?
Upvotes: 0
Views: 2408
Reputation: 459
ClientBundle with TextResource for this two javaScript.files
Inject this TextResources as Script(don't miss setRemoveTag(false) as this is FromString)
ScriptInjector.fromString(myRes.sockJs().getText()).setRemoveTag(false).inject();
And establish a connection in JSNI
var socket = new SockJs('myPath');
var stompClient = Stomp.over(socket);
var connect_callback = function() {.....}
stompClient.connect({}, connect_callback)
You are able to return this stompClient as JavaScriptObject and later in jsni methods subscribe or send messages, or take a look at GWT JSNI Overlay functionality.
Upvotes: 0
Reputation: 121
I use Atmosphere and it works fine. You will find a chat for example in GWT.
Upvotes: 3
Reputation: 121998
Sounds like you are talking about Comet and Gwt-Ws.
To make them work you have to configure your Jetty server I mean to use JettyLauncher.
And the above frameworks supports in Webkit browsers like Chrome
, Safari
.
Upvotes: 1