Class EchoProtocol
java.lang.Object
org.atmosphere.websocket.protocol.EchoProtocol
- All Implemented Interfaces:
AtmosphereConfigAware,WebSocketProtocol
Simple
WebSocketProcessor that invoke the Broadcaster.broadcast(java.lang.Object) 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
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidconfigure(AtmosphereConfig config) Configure an AtmosphereFramework object.voidInvoked when a WebSocket is closedvoidonError(WebSocket webSocket, WebSocketProcessor.WebSocketException t) Invoked when an error occurs.Parse the WebSocket message, and delegate the processing to theAtmosphereFramework.asyncSupportor to any existing technology.Parse the WebSocket message, and delegate the processing to theAtmosphereFramework.asyncSupportor to any existing technology.voidInvoked when a WebSocket is opened
-
Constructor Details
-
EchoProtocol
public EchoProtocol()
-
-
Method Details
-
onMessage
Description copied from interface:WebSocketProtocolParse the WebSocket message, and delegate the processing to theAtmosphereFramework.asyncSupportor to any existing technology. InvokingAtmosphereFramework.asyncSupportwill delegate the request processing to theAtmosphereHandlerimplementation. 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.- Specified by:
onMessagein interfaceWebSocketProtocol- Parameters:
webSocket- TheWebSocketconnectiondata- The Websocket message- Returns:
- a List of
AtmosphereRequest
-
onMessage
Description copied from interface:WebSocketProtocolParse the WebSocket message, and delegate the processing to theAtmosphereFramework.asyncSupportor to any existing technology. InvokingAtmosphereFramework.asyncSupportwill delegate the request processing to theAtmosphereHandlerimplementation. 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.- Specified by:
onMessagein interfaceWebSocketProtocol- Parameters:
webSocket- TheWebSocketconnectionoffset- offset message indexlength- length of the message.- Returns:
- a List of
AtmosphereRequest
-
configure
Description copied from interface:AtmosphereConfigAwareConfigure an AtmosphereFramework object.- Specified by:
configurein interfaceAtmosphereConfigAware- Parameters:
config-AtmosphereConfig
-
onOpen
Description copied from interface:WebSocketProtocolInvoked when a WebSocket is opened- Specified by:
onOpenin interfaceWebSocketProtocol- Parameters:
webSocket-WebSocket
-
onClose
Description copied from interface:WebSocketProtocolInvoked when a WebSocket is closed- Specified by:
onClosein interfaceWebSocketProtocol- Parameters:
webSocket-WebSocket
-
onError
Description copied from interface:WebSocketProtocolInvoked when an error occurs.- Specified by:
onErrorin interfaceWebSocketProtocol- Parameters:
webSocket-WebSockett- aWebSocketProcessor.WebSocketException
-