public class EchoProtocol extends java.lang.Object implements WebSocketProtocol
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.| Constructor and Description |
|---|
EchoProtocol() |
| Modifier and Type | Method and Description |
|---|---|
void |
configure(AtmosphereConfig config)
Allow an implementation to query the AtmosphereConfig of init-param, etc.
|
void |
onClose(WebSocket webSocket)
Invoked when a WebSocket is closed
|
void |
onError(WebSocket webSocket,
WebSocketProcessor.WebSocketException t)
Invoked when an error occurs.
|
java.util.List<AtmosphereRequest> |
onMessage(WebSocket webSocket,
byte[] data,
int offset,
int length)
Parse the WebSocket message, and delegate the processing to the
AtmosphereFramework.asyncSupport or
to any existing technology. |
java.util.List<AtmosphereRequest> |
onMessage(WebSocket webSocket,
java.lang.String data)
Parse the WebSocket message, and delegate the processing to the
AtmosphereFramework.asyncSupport or
to any existing technology. |
void |
onOpen(WebSocket webSocket)
Invoked when a WebSocket is opened
|
public java.util.List<AtmosphereRequest> onMessage(WebSocket webSocket, java.lang.String data)
AtmosphereFramework.asyncSupport or
to any existing technology. Invoking AtmosphereFramework.asyncSupport 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;
onMessage in interface WebSocketProtocolwebSocket - The WebSocket connectiondata - The Websocket messageAtmosphereResource, or null if the request won't be dispatched.public java.util.List<AtmosphereRequest> onMessage(WebSocket webSocket, byte[] data, int offset, int length)
AtmosphereFramework.asyncSupport or
to any existing technology. Invoking AtmosphereFramework.asyncSupport 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;
onMessage in interface WebSocketProtocolwebSocket - The WebSocket connectionoffset - offset message indexlength - length of the message.AtmosphereResource, or null if the request won't be dispatched.public void configure(AtmosphereConfig config)
configure in interface WebSocketProtocolconfig - AtmosphereConfigpublic void onOpen(WebSocket webSocket)
onOpen in interface WebSocketProtocolwebSocket - WebSocketpublic void onClose(WebSocket webSocket)
onClose in interface WebSocketProtocolwebSocket - WebSocketpublic void onError(WebSocket webSocket, WebSocketProcessor.WebSocketException t)
onError in interface WebSocketProtocolwebSocket - WebSockett - a WebSocketProcessor.WebSocketExceptionCopyright © 2018. All Rights Reserved.