Interface WebSocketProcessor

  • All Known Implementing Classes:
    DefaultWebSocketProcessor, WebSocketProcessorAdapter

    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
    • Method Detail

      • handshake

        boolean handshake​(javax.servlet.http.HttpServletRequest request)
        Determine if the WebSocket's handshake data can be processed, or if the request be cancelled. Since it's container related native API, the HttpServletRequest might be null, so implementation must check for null.
        Parameters:
        request - HttpServletRequest
        Returns:
        true if the processing can continue, false if not.
      • open

        void open​(WebSocket webSocket,
                  AtmosphereRequest request,
                  AtmosphereResponse response)
           throws java.io.IOException
        Invoked when a WebSocket gets opened by the underlying container
        Parameters:
        request -
        Throws:
        java.io.IOException
      • invokeWebSocketProtocol

        void invokeWebSocketProtocol​(WebSocket webSocket,
                                     java.lang.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 -
      • invokeWebSocketProtocol

        void invokeWebSocketProtocol​(WebSocket webSocket,
                                     java.io.InputStream stream)
        Invoked when a WebSocket message gets received from the underlying container
        Parameters:
        stream -
      • invokeWebSocketProtocol

        void invokeWebSocketProtocol​(WebSocket webSocket,
                                     java.io.Reader reader)
                              throws java.io.IOException
        Invoked when a WebSocket message gets received from the underlying container
        Parameters:
        reader -
        Throws:
        java.io.IOException
      • close

        void close​(WebSocket webSocket,
                   int closeCode)
        Invked when the WebServer is closing the native WebSocket
        Parameters:
        closeCode -
      • destroy

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