WebSockets for GWT and Vaadin.
NOTE: this add-on has a sister project DontPush OzoneLayer. Its is currently more actively maintained and the suggested web socket/server push solution by the author.
This add-on takes server side push to a next level. The open connection is used for both inbound and outbound traffic, instead of using poller or separate connection just to notify the client about the updates. No need for a push() method to notify about changes, but things will just work. Also the latency to previous solutions/workarounds should be superior.
The add-on contains a custom servlet and a client side engine with steroids to replace XHR based communication with WebSocket protocol. WebSocket is a part of the HTML5 standard and already implemented in Safari, Chrome, Opera and FF4. (UPDATE FF4 and Opera finally left WebSocket support out of current releases). For older browsers the add-on use flash fallback called web-socket-js.
For non-vaadin users the jar file contains a GWT module called org.vaadin.dontpush.vwebsocket.VWebSocket that can be used independently of Vaadin. Compared to alternatives that I found it is superior because it supports hosted mode properly.
To use this with Vaadin you will currently need to:
- grab the latest Jetty 7.4
- use the org.vaadin.dontpush.server.impl.jetty.DontPushServlet instead of default Vaadin servlet
- rebuild the widgetset with this add-on jar
To use this with plain GWT:
- grab the jar file and inherit org.vaadin.dontpush.vwebsocket.VWebSocket from it
- use WebSocket class to connect your GWT app to your own custom WebSocket server
Note, this is early prototype release. Don't expect everything to work. Patches and comments are welcome.