public class SimpleHttpProtocol extends Object implements WebSocketProtocol, Serializable
AsynchronousProcessor class, this class is responsible for dispatching WebSocket messages to the
proper WebSocket implementation by wrapping the Websocket message's bytes within
an HttpServletRequest.
The content-type is defined using ApplicationConfig.WEBSOCKET_CONTENT_TYPE property
The method is defined using ApplicationConfig.WEBSOCKET_METHOD property
| Modifier and Type | Field and Description |
|---|---|
protected String |
contentType |
protected String |
delimiter |
protected boolean |
destroyable |
protected String |
methodType |
protected boolean |
rewriteUri |
protected static String |
TEXT |
| Constructor and Description |
|---|
SimpleHttpProtocol() |
| Modifier and Type | Method and Description |
|---|---|
void |
configure(AtmosphereConfig config)
Configure an AtmosphereFramework object.
|
void |
onClose(WebSocket webSocket)
Invoked when a WebSocket is closed
|
void |
onError(WebSocket webSocket,
WebSocketProcessor.WebSocketException t)
Invoked when an error occurs.
|
List<AtmosphereRequest> |
onMessage(WebSocket webSocket,
byte[] d,
int offset,
int length)
Parse the WebSocket message, and delegate the processing to the
AtmosphereFramework.asyncSupport or
to any existing technology. |
List<AtmosphereRequest> |
onMessage(WebSocket webSocket,
String message)
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
|
protected static final String TEXT
protected String contentType
protected String methodType
protected String delimiter
protected boolean destroyable
protected boolean rewriteUri
public void configure(AtmosphereConfig config)
AtmosphereConfigAwareconfigure in interface AtmosphereConfigAwareconfig - AtmosphereConfigpublic List<AtmosphereRequest> onMessage(WebSocket webSocket, String message)
WebSocketProtocolAtmosphereFramework.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 connectionmessage - The Websocket messageAtmosphereRequestpublic List<AtmosphereRequest> onMessage(WebSocket webSocket, byte[] d, int offset, int length)
WebSocketProtocolAtmosphereFramework.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.AtmosphereRequestpublic void onOpen(WebSocket webSocket)
WebSocketProtocolonOpen in interface WebSocketProtocolwebSocket - WebSocketpublic void onClose(WebSocket webSocket)
WebSocketProtocolonClose in interface WebSocketProtocolwebSocket - WebSocketpublic void onError(WebSocket webSocket, WebSocketProcessor.WebSocketException t)
WebSocketProtocolonError in interface WebSocketProtocolwebSocket - WebSockett - a WebSocketProcessor.WebSocketExceptionCopyright © 2016. All rights reserved.