Package org.eclipse.net4j.ws.jetty

## Class Net4jWebSocket

- java.lang.Object
- - org.eclipse.net4j.ws.jetty.Net4jWebSocket

- All Implemented Interfaces:
    `org.eclipse.jetty.websocket.api.WebSocketConnectionListener`, `org.eclipse.jetty.websocket.api.WebSocketListener`

      public class Net4jWebSocket
      extends java.lang.Object
      implements org.eclipse.jetty.websocket.api.WebSocketListener

  Author:
    Eike Stepper

- - ### Field Summary

    Fields
    Modifier and Type | Field | Description
    --- | --- | ---
    `static short` | `CONTROL_CHANNEL_ID` |
    `static byte` | `OPCODE_DEREGISTRATION` |
    `static byte` | `OPCODE_NEGOTIATION` |
    `static byte` | `OPCODE_REGISTRATION` |
    `static byte` | `OPCODE_REGISTRATION_ACK` |

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `Net4jWebSocket()` | Called by `Net4jWebSocketServlet`.
    `Net4jWebSocket​(IWSConnector connector)` | Called by `WSClientConnector`.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `void` | `close()` |
    `void` | `deregisterChannel​(short channelID)` |
    `IWSConnector` | `getConnector()` |
    `org.eclipse.jetty.websocket.api.Session` | `getSession()` |
    `boolean` | `isClient()` |
    `void` | `onWebSocketBinary​(byte[] payload, int offset, int len)` |
    `void` | `onWebSocketClose​(int statusCode, java.lang.String reason)` |
    `void` | `onWebSocketConnect​(org.eclipse.jetty.websocket.api.Session session)` |
    `void` | `onWebSocketError​(java.lang.Throwable cause)` |
    `void` | `onWebSocketText​(java.lang.String message)` |
    `void` | `registerChannel​(short channelID, long timeout, IProtocol<?> protocol)` |
    `void` | `sendBuffer​(IBuffer buffer)` |

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### CONTROL_CHANNEL_ID

          public static final short CONTROL_CHANNEL_ID

      See Also:
        Constant Field Values

    - #### OPCODE_NEGOTIATION

          public static final byte OPCODE_NEGOTIATION

      See Also:
        Constant Field Values

    - #### OPCODE_REGISTRATION

          public static final byte OPCODE_REGISTRATION

      See Also:
        Constant Field Values

    - #### OPCODE_REGISTRATION_ACK

          public static final byte OPCODE_REGISTRATION_ACK

      See Also:
        Constant Field Values

    - #### OPCODE_DEREGISTRATION

          public static final byte OPCODE_DEREGISTRATION

      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### Net4jWebSocket

          public Net4jWebSocket()

      Called by `Net4jWebSocketServlet`.

    - #### Net4jWebSocket

          public Net4jWebSocket​(IWSConnector connector)

      Called by `WSClientConnector`.

  - ### Method Detail

    - #### getConnector

          public IWSConnector getConnector()

    - #### getSession

          public org.eclipse.jetty.websocket.api.Session getSession()

    - #### isClient

          public boolean isClient()

    - #### onWebSocketConnect

          public void onWebSocketConnect​(org.eclipse.jetty.websocket.api.Session session)

      Specified by:
        `onWebSocketConnect` in interface `org.eclipse.jetty.websocket.api.WebSocketConnectionListener`

    - #### close

          public void close()

    - #### onWebSocketClose

          public void onWebSocketClose​(int statusCode,
                                       java.lang.String reason)

      Specified by:
        `onWebSocketClose` in interface `org.eclipse.jetty.websocket.api.WebSocketConnectionListener`

    - #### registerChannel

          public void registerChannel​(short channelID,
                                      long timeout,
                                      IProtocol<?> protocol)
                               throws java.io.IOException

      Throws:
        `java.io.IOException`

    - #### deregisterChannel

          public void deregisterChannel​(short channelID)
                                 throws java.io.IOException

      Throws:
        `java.io.IOException`

    - #### sendBuffer

          public void sendBuffer​(IBuffer buffer)

    - #### onWebSocketBinary

          public void onWebSocketBinary​(byte[] payload,
                                        int offset,
                                        int len)

      Specified by:
        `onWebSocketBinary` in interface `org.eclipse.jetty.websocket.api.WebSocketListener`

    - #### onWebSocketText

          public void onWebSocketText​(java.lang.String message)

      Specified by:
        `onWebSocketText` in interface `org.eclipse.jetty.websocket.api.WebSocketListener`

    - #### onWebSocketError

          public void onWebSocketError​(java.lang.Throwable cause)

      Specified by:
        `onWebSocketError` in interface `org.eclipse.jetty.websocket.api.WebSocketConnectionListener`