WebSocket API in Resin 4.0.x
Our WebSockets API is not available in the JavaDoc at
http://caucho.com/resin-4.0-javadoc/com/caucho/servlet/package-summary.html
The basic classes are similar to the Servlet 3.0 async. The main application interface is WebSocketListener. When a new data is available on the socket, Resin will call the onRead method. The application can then read the entire frame from the socket.
The WebSocketContext gives access to the underlying InputStream and OutputStream of the socket. These are raw streams, because we want to give frameworks control over every byte. In other words, the application’s sub-protocol is in a better position to parse the WebSocket framing efficiently.
The WebSocketServletRequest is implemented by Resin’s HttpServletRequest. Basically, it’s a way for us to extend the Servlet 3.0 HttpServletRequest without actually modifying it. I’d expect Servlet 4.0 to add the startWebSocket method directly.
