org.atmosphere.websocket
Interface WebSocketProtocol

All Known Implementing Classes:
EchoProtocol, SimpleHttpProtocol

public interface WebSocketProtocol

A WebSocket based protocol implementation. Implement this call to process WebSocket message and dispatch it to Atmosphere or any consumer of WebSocket message

Author:
Jeanfrancois Arcand

Method Summary
 void configure(AtmosphereServlet.AtmosphereConfig config)
          Allow an implementation to query the AtmosphereConfig of init-param, etc.
 javax.servlet.http.HttpServletRequest parseMessage(AtmosphereResource<javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse> resource, byte[] data, int offset, int length)
          Parse the WebSocket message, and delegate the processing to the AtmosphereServlet.cometSupport or to any existing technology.
 javax.servlet.http.HttpServletRequest parseMessage(AtmosphereResource<javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse> resource, String data)
          Parse the WebSocket message, and delegate the processing to the AtmosphereServlet.cometSupport or to any existing technology.
 

Method Detail

configure

void configure(AtmosphereServlet.AtmosphereConfig config)
Allow an implementation to query the AtmosphereConfig of init-param, etc.

Parameters:
config - AtmosphereServlet.AtmosphereConfig

parseMessage

javax.servlet.http.HttpServletRequest parseMessage(AtmosphereResource<javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse> resource,
                                                   String data)
Parse the WebSocket message, and delegate the processing to the AtmosphereServlet.cometSupport or to any existing technology. Invoking AtmosphereServlet.cometSupport will delegate the request processing to the AtmosphereHandler implementation. Returning null means this implementation will handle itself the processing/dispatching of the WebSocket's request;
As an example, this is how Websocket messages are delegated to the Jersey runtime.

Parameters:
resource - The AtmosphereResource associated with the WebSocket Handshake
data - The Websocket message

parseMessage

javax.servlet.http.HttpServletRequest parseMessage(AtmosphereResource<javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse> resource,
                                                   byte[] data,
                                                   int offset,
                                                   int length)
Parse the WebSocket message, and delegate the processing to the AtmosphereServlet.cometSupport or to any existing technology. Invoking AtmosphereServlet.cometSupport will delegate the request processing to the AtmosphereHandler implementation. Returning null means this implementation will handle itself the processing/dispatching of the WebSocket's request;
As an example, this is how Websocket messages are delegated to the Jersey runtime.

Parameters:
resource - The AtmosphereResource associated with the WebSocket Handshake
data - The Websocket message
offset - offset message index
length - length of the message.


Copyright © 2011. All Rights Reserved.