org.atmosphere.websocket.protocol
Class EchoProtocol

java.lang.Object
  extended by org.atmosphere.websocket.WebSocketProcessor
      extended by org.atmosphere.websocket.protocol.EchoProtocol
All Implemented Interfaces:
Serializable

public class EchoProtocol
extends WebSocketProcessor

Simple WebSocketProcessor that invoke the Broadcaster.broadcast(T) API when a WebSocket message is received. NOTE: If WebSocket frame are used the bytes will be decoded into a String, which reduce performance.

Author:
Jeanfrancois Arcand
See Also:
Serialized Form

Constructor Summary
EchoProtocol(AtmosphereServlet atmosphereServlet, WebSocket webSocket)
           
 
Method Summary
 void parseMessage(byte[] data, int offset, int length)
          Parse the WebSocket message, and delegate the processing to the AtmosphereServlet.cometSupport or to any existing technology.
 void parseMessage(String data)
          Parse the WebSocket message, and delegate the processing to the AtmosphereServlet.cometSupport or to any existing technology.
 
Methods inherited from class org.atmosphere.websocket.WebSocketProcessor
close, configureHeader, dispatch, dispatch, notifyListener, request, resource, toString, webSocketSupport
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

EchoProtocol

public EchoProtocol(AtmosphereServlet atmosphereServlet,
                    WebSocket webSocket)
Method Detail

parseMessage

public void parseMessage(String data)
Description copied from class: WebSocketProcessor
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. As an example, this is how Websocket messages are delegated to the Jersey runtime.

Specified by:
parseMessage in class WebSocketProcessor
Parameters:
data - The Websocket message

parseMessage

public void parseMessage(byte[] data,
                         int offset,
                         int length)
Description copied from class: WebSocketProcessor
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. As an example, this is how Websocket messages are delegated to the Jersey runtime.

Specified by:
parseMessage in class WebSocketProcessor
Parameters:
data - The Websocket message
offset - offset message index
length - length of the message.


Copyright © 2011. All Rights Reserved.