org.atmosphere.websocket
Interface WebSocketProcessor

All Known Implementing Classes:
DefaultWebSocketProcessor

public interface WebSocketProcessor

Atmosphere's WebSocket Support implementation. The default behavior is implemented in DefaultWebSocketProcessor. This class is targeted at framework developer as it requires Atmosphere's internal knowledge.
This class can also be used to implement the JSR 345 recommendation.

Author:
Jeanfrancois Arcand

Nested Class Summary
static class WebSocketProcessor.WebSocketException
          An exception that can be used to flag problems with the WebSocket processing.
 
Method Summary
 void close(WebSocket webSocket, int closeCode)
          Invked when the WebServer is closing the native WebSocket
 void destroy()
          Destroy all resources associated with this class.
 void invokeWebSocketProtocol(WebSocket webSocket, byte[] data, int offset, int length)
          Invoked when a WebSocket message gets received from the underlying container
 void invokeWebSocketProtocol(WebSocket webSocket, String webSocketMessage)
          Invoked when a WebSocket message gets received from the underlying container
 void notifyListener(WebSocket webSocket, WebSocketEventListener.WebSocketEvent webSocketEvent)
          Notify all WebSocketEventListener
 void open(WebSocket webSocket, AtmosphereRequest request)
          Invoked when a WebSocket gets opened by the underlying container
 WebSocketProcessor registerWebSocketHandler(String path, WebSocketHandler webSockethandler)
          Register a WebSocketHandler
 

Method Detail

registerWebSocketHandler

WebSocketProcessor registerWebSocketHandler(String path,
                                            WebSocketHandler webSockethandler)
Register a WebSocketHandler

Parameters:
path - the URI mapping the WebSocketHandler
webSockethandler - an instance of WebSocketHandler
Returns:
this

open

void open(WebSocket webSocket,
          AtmosphereRequest request)
          throws IOException
Invoked when a WebSocket gets opened by the underlying container

Parameters:
request -
Throws:
IOException

invokeWebSocketProtocol

void invokeWebSocketProtocol(WebSocket webSocket,
                             String webSocketMessage)
Invoked when a WebSocket message gets received from the underlying container

Parameters:
webSocketMessage -

invokeWebSocketProtocol

void invokeWebSocketProtocol(WebSocket webSocket,
                             byte[] data,
                             int offset,
                             int length)
Invoked when a WebSocket message gets received from the underlying container

Parameters:
data -

close

void close(WebSocket webSocket,
           int closeCode)
Invked when the WebServer is closing the native WebSocket

Parameters:
closeCode -

notifyListener

void notifyListener(WebSocket webSocket,
                    WebSocketEventListener.WebSocketEvent webSocketEvent)
Notify all WebSocketEventListener

Parameters:
webSocketEvent -

destroy

void destroy()
Destroy all resources associated with this class.



Copyright © 2012. All Rights Reserved.