Package 

Class WebSocketClient

  • All Implemented Interfaces:
    com.tds.common.websocket.conn.WebSocket , com.tds.common.websocket.conn.WebSocketListener , java.lang.Runnable

    
    public class WebSocketClient
    extends WebSocketClient
                        
    • Method Summary

      Modifier and Type Method Description
      void removeEventListener()
      void onOpen(ServerHandshake handshakedata) Called after an opening handshake has been performed and the given websocket is ready to bewritten on.
      void onMessage(String s) Callback for string messages received from the remote host
      void onClose(int code, String reason, boolean remote) Called after the websocket connection has been closed.
      void onError(Exception e) Called when errors occurs.
      • Methods inherited from class com.tds.common.websocket.client.WebSocketClient

        addHeader, clearHeaders, close, close, close, closeBlocking, closeConnection, connect, connectBlocking, connectBlocking, getAttachment, getConnection, getDraft, getLocalSocketAddress, getLocalSocketAddress, getProtocol, getReadyState, getRemoteSocketAddress, getRemoteSocketAddress, getResourceDescriptor, getSSLSession, getSocket, getURI, hasBufferedData, hasSSLSupport, isClosed, isClosing, isFlushAndClose, isOpen, onCloseInitiated, onClosing, onError, onMessage, onMessage, onWebsocketClose, onWebsocketCloseInitiated, onWebsocketClosing, onWebsocketError, onWebsocketMessage, onWebsocketMessage, onWebsocketOpen, onWriteDemand, reconnect, reconnectBlocking, removeHeader, run, send, send, send, sendFragmentedFrame, sendFrame, sendFrame, sendPing, setAttachment, setDnsResolver, setProxy, setSocket, setSocketFactory
      • Methods inherited from class com.tds.common.websocket.conn.AbstractWebSocket

        getConnectionLostTimeout, isReuseAddr, isTcpNoDelay, setConnectionLostTimeout, setReuseAddr, setTcpNoDelay
      • Methods inherited from class com.tds.common.websocket.conn.WebSocketAdapter

        onPreparePing, onWebsocketHandshakeReceivedAsClient, onWebsocketHandshakeReceivedAsServer, onWebsocketHandshakeSentAsClient, onWebsocketPing, onWebsocketPong
      • Methods inherited from class com.tds.common.websocket.conn.WebSocketListener

        onWebsocketClose, onWebsocketCloseInitiated, onWebsocketClosing, onWebsocketHandshakeReceivedAsClient, onWebsocketHandshakeReceivedAsServer, onWebsocketOpen
      • Methods inherited from class java.lang.Runnable

        run
      • Methods inherited from class com.tds.common.websocket.conn.WebSocket

        send
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • onOpen

         void onOpen(ServerHandshake handshakedata)

        Called after an opening handshake has been performed and the given websocket is ready to bewritten on.

        Parameters:
        handshakedata - The handshake of the websocket instance
      • onMessage

         void onMessage(String s)

        Callback for string messages received from the remote host

      • onClose

         void onClose(int code, String reason, boolean remote)

        Called after the websocket connection has been closed.

        Parameters:
        code - The codes can be looked up here: CloseFrame
        reason - Additional information string
        remote - Returns whether or not the closing of the connection was initiated by the remotehost.
      • onError

         void onError(Exception e)

        Called when errors occurs. If an error causes the websocket connection to fail will be called additionally. This method will be calledprimarily because of IO or protocol errors. If the given exception is an RuntimeExceptionthat probably means that you encountered a bug.