Package org.atmosphere.websocket
Interface WebSocketProtocol
- All Superinterfaces:
AtmosphereConfigAware
- All Known Subinterfaces:
WebSocketProtocolStream
- All Known Implementing Classes:
EchoProtocol,SimpleHttpProtocol,StreamingHttpProtocol
A WebSocket based protocol implementation. Implement this class to process WebSockets messages and dispatch it to
Atmosphere or any consumer of WebSocket message.
- Author:
- Jeanfrancois Arcand
-
Method Summary
Modifier and TypeMethodDescriptionvoidInvoked 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 openedMethods inherited from interface org.atmosphere.inject.AtmosphereConfigAware
configure
-
Method Details
-
onMessage
Parse 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.- Parameters:
webSocket- TheWebSocketconnectiondata- The Websocket message- Returns:
- a List of
AtmosphereRequest
-
onMessage
Parse 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.- Parameters:
webSocket- TheWebSocketconnectionoffset- offset message indexlength- length of the message.- Returns:
- a List of
AtmosphereRequest
-
onOpen
Invoked when a WebSocket is opened- Parameters:
webSocket-WebSocket
-
onClose
Invoked when a WebSocket is closed- Parameters:
webSocket-WebSocket
-
onError
Invoked when an error occurs.- Parameters:
webSocket-WebSockett- aWebSocketProcessor.WebSocketException
-