For http://wizzworld.fr/ I need to program WebSocket on Iphone , with of course GWT!!!
Here is the solution :
1) do as my tutorial about GWTRaphael : clean the project as i said.
2) download GWTPhoneGap http://code.google.com/p/gwt-phonegap/ and http://code.google.com/p/gwt-ws/
3) Rigth on the project, Build Path->configure Build Path add add the donwloaded two JARs.
That's near finish,now we can do some code. The example of gwt-ws is not good,so i give you mine :
if (!JavaScriptWebSocket.IsSupported())
return;
String webSocketURL ="ws://your.url/websocket";
WebSocket webSocketConnection = new JavaScriptWebSocketFactory().createWebSocket(webSocketURL, new WebSocketCallback() {
@Override
public void onOpen(WebSocket webSocket) {
webSocket.send("Hello World"); }
@Override
public void onMessage(WebSocket webSocket, String message) {
Window.alert(message); }
@Override
public void onError(WebSocket webSocket) {
}
@Override
public void onClose(WebSocket webSocket) {
} });
That's all for now, next time we will see how to use phonegap on Iphone&android.
WebSocket on IPhone with GWT-WS
Inscription à :
Publier les commentaires (Atom)
Aucun commentaire:
Enregistrer un commentaire