...
Add dependency to either org.apache.wicket:wicket-native-websocket-jetty9, org.apache.wicket:wicket-native-websocket-jetty, or org.apache.wicket:wicket-native-websocket-tomcat.
...
Setup the custom WicketFilter implementation for the chosen web container in your web.xml.
For Jetty 9.0+ this is
<filter-class>org.apache.wicket.protocol.ws.jetty9.Jetty9WebSocketFilter</filter-class>
For Jetty 7.5+ - 8.x this is
<filter-class>org.apache.wicket.protocol.ws.httpjetty7.Jetty7WebSocketFilter</filter-class>
For Tomcat 7.0.27+:
<filter-class>org.apache.wicket.protocol.httpws.tomcat7.Tomcat7WebSocketFilter</filter-class>
...
Wicket.WebSocket is a simple wrapper around the native window.WebSocket API which is used to intercept the calls and to fire special events (Wicket.Event PubSub).
Event name | Arguments | Description |
---|---|---|
/websocket/open | jqEvent | A WebSocket connection has been just opened |
/websocket/message | jqEvent, message | A message has been received from the server |
/websocket/closed | jqEvent | A WebSocket connection has been closed |
/websocket/error | jqEvent | An error occurred in the communication. The connection will be closed |
...
Currently supported web containers are Jetty 7.5+ and Tomcat 7.0.27+.
Currently supported browsers are Google Chrome/Chromium, Firefox 11+, Safari 5.x (with Jetty), IE10.
FAQ
Request and session scoped beans do not work.
The Web Socket communication is not processed by Servlet Filters and Listeners and thus the Dependency Injection libraries have no chance to export the request and session beans.