com.amos.flyinn.signaling

## Class ClientSocket

- java.lang.Object
- - org.java_websocket.WebSocketAdapter
  - - org.java_websocket.AbstractWebSocket
    - - org.java_websocket.client.WebSocketClient
      - - com.amos.flyinn.signaling.ClientSocket

- All Implemented Interfaces:
    Emitter, java.lang.Runnable, org.java_websocket.WebSocket, org.java_websocket.WebSocketListener

      public class ClientSocket
      extends org.java_websocket.client.WebSocketClient
      implements Emitter

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from interface org.java_websocket.WebSocket

      `org.java_websocket.WebSocket.READYSTATE, org.java_websocket.WebSocket.Role`

  - ### Field Summary

    - ### Fields inherited from class org.java_websocket.client.WebSocketClient

      `uri`

    - ### Fields inherited from interface org.java_websocket.WebSocket

      `DEFAULT_PORT, DEFAULT_WSS_PORT`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `ClientSocket(java.net.URI serverUri, IPeer peer)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `onClose(int code, java.lang.String reason, boolean remote)`
    `void` | `onError(java.lang.Exception ex)`
    `void` | `onMessage(java.lang.String message)` This method receive the information that was sent by the signaling server.
    `void` | `onOpen(org.java_websocket.handshake.ServerHandshake handshakedata)`
    `org.json.JSONObject` | `serializeIceCandidate(org.webrtc.IceCandidate candidate)` This method is useful to serialize an ice candidate object that is supposed to be read by the signaling server.
    `org.json.JSONObject` | `serializeSessionDescription(org.webrtc.SessionDescription session)` This method is useful to serialize serial descriptor object that is supposed to be read by the signaling server.
    `void` | `shareIceCandidate(org.webrtc.IceCandidate candidate)` This method is responsible to send the serialized ice candidate to the signaling server.
    `void` | `shareSessionDescription(org.webrtc.SessionDescription session)` This method is responsible to send the serialized session descriptor to the signaling server.

    - ### Methods inherited from class org.java_websocket.client.WebSocketClient

      `close, close, close, closeBlocking, closeConnection, connect, connectBlocking, connectBlocking, getAttachment, getConnection, getConnections, getDraft, getLocalSocketAddress, getLocalSocketAddress, getReadyState, getRemoteSocketAddress, getRemoteSocketAddress, getResourceDescriptor, getSocket, getURI, hasBufferedData, isClosed, isClosing, isConnecting, isFlushAndClose, isOpen, onCloseInitiated, onClosing, onFragment, onMessage, onWebsocketClose, onWebsocketCloseInitiated, onWebsocketClosing, onWebsocketError, onWebsocketMessage, onWebsocketMessage, onWebsocketMessageFragment, onWebsocketOpen, onWriteDemand, reconnect, reconnectBlocking, run, send, send, send, sendFragmentedFrame, sendFrame, sendFrame, sendPing, setAttachment, setProxy, setSocket`

    - ### Methods inherited from class org.java_websocket.AbstractWebSocket

      `getConnectionLostTimeout, isReuseAddr, isTcpNoDelay, setConnectionLostTimeout, setReuseAddr, setTcpNoDelay, startConnectionLostTimer, stopConnectionLostTimer`

    - ### Methods inherited from class org.java_websocket.WebSocketAdapter

      `onWebsocketHandshakeReceivedAsClient, onWebsocketHandshakeReceivedAsServer, onWebsocketHandshakeSentAsClient, onWebsocketPing, onWebsocketPong`

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

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

- - ### Constructor Detail

    - #### ClientSocket

          public ClientSocket(java.net.URI serverUri,
                              IPeer peer)

  - ### Method Detail

    - #### onOpen

          public void onOpen(org.java_websocket.handshake.ServerHandshake handshakedata)

      Specified by:
        `onOpen` in class `org.java_websocket.client.WebSocketClient`

    - #### onMessage

          public void onMessage(java.lang.String message)

      This method receive the information that was sent by the signaling server. It is also responsible to unserialize the messages and set the session descriptor and the ice candidate when received
      Specified by:
        `onMessage` in class `org.java_websocket.client.WebSocketClient`
      Parameters:
        `message` - the message information as string that contains the serialized message.

    - #### onClose

          public void onClose(int code,
                              java.lang.String reason,
                              boolean remote)

      Specified by:
        `onClose` in class `org.java_websocket.client.WebSocketClient`

    - #### onError

          public void onError(java.lang.Exception ex)

      Specified by:
        `onError` in class `org.java_websocket.client.WebSocketClient`

    - #### serializeIceCandidate

          public org.json.JSONObject serializeIceCandidate(org.webrtc.IceCandidate candidate)

      This method is useful to serialize an ice candidate object that is supposed to be read by the signaling server.
      Parameters:
        `candidate` - candidate that is going to be serialized
      Returns:
        JsonObject returns the JsonObject that contains information about some ice candidate

    - #### shareIceCandidate

          public void shareIceCandidate(org.webrtc.IceCandidate candidate)

      This method is responsible to send the serialized ice candidate to the signaling server.
      Specified by:
        `shareIceCandidate` in interface `Emitter`
      Parameters:
        `candidate` - candidate that is going to be shared with the signaling server.

    - #### serializeSessionDescription

          public org.json.JSONObject serializeSessionDescription(org.webrtc.SessionDescription session)

      This method is useful to serialize serial descriptor object that is supposed to be read by the signaling server.
      Parameters:
        `session` - Session descriptor that is going to be serialized
      Returns:
        JsonObject returns the JsonObject that contains information about some session descriptor

    - #### shareSessionDescription

          public void shareSessionDescription(org.webrtc.SessionDescription session)

      This method is responsible to send the serialized session descriptor to the signaling server.
      Specified by:
        `shareSessionDescription` in interface `Emitter`
      Parameters:
        `session` - session descriptor that is going to be shared with the signaling server.