Interface WebSocketListener


  • public interface WebSocketListener
    A generic WebSocketListener for WebSocket events. Use the appropriate listener for receiving message bytes.
    • Method Detail

      • onOpen

        void onOpen​(WebSocket websocket)
        Invoked when the WebSocket is open.
        Parameters:
        websocket - the WebSocket
      • onClose

        void onClose​(WebSocket websocket,
                     int code,
                     String reason)
        Invoked when the WebSocket is closed.
        Parameters:
        websocket - the WebSocket
        code - the status code
        reason - the reason message
        See Also:
        "http://tools.ietf.org/html/rfc6455#section-5.5.1"
      • onBinaryFrame

        default void onBinaryFrame​(byte[] payload,
                                   boolean finalFragment,
                                   int rsv)
        Invoked when a binary frame is received.
        Parameters:
        payload - a byte array
        finalFragment - true if this frame is the final fragment
        rsv - extension bits
      • onTextFrame

        default void onTextFrame​(String payload,
                                 boolean finalFragment,
                                 int rsv)
        Invoked when a text frame is received.
        Parameters:
        payload - a UTF-8 String message
        finalFragment - true if this frame is the final fragment
        rsv - extension bits
      • onPingFrame

        default void onPingFrame​(byte[] payload)
        Invoked when a ping frame is received
        Parameters:
        payload - a byte array
      • onPongFrame

        default void onPongFrame​(byte[] payload)
        Invoked when a pong frame is received
        Parameters:
        payload - a byte array