com.taosdata.jdbc.ws

## Class WSClient

- java.lang.Object
- - org.java_websocket.WebSocketAdapter
  - - org.java_websocket.AbstractWebSocket
    - - org.java_websocket.client.WebSocketClient
      - - com.taosdata.jdbc.ws.WSClient

All Implemented Interfaces:
  AutoCloseable, Runnable, org.java_websocket.WebSocket, org.java_websocket.WebSocketListener

    public class WSClient
    extends org.java_websocket.client.WebSocketClient
    implements AutoCloseable

### Field Summary

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

`uri`

### Constructor Summary

Constructors
Constructor and Description
`WSClient(URI serverUri, Transport transport, ConnectionParam connectionParam, WSFunction function)` create websocket connection client

### Method Summary

All Methods Static Methods Instance Methods Concrete Methods
`static WSClient` `getInstance(ConnectionParam params, WSFunction function, Transport transport)`
`void` `onClose(int code, String reason, boolean remote)`
`void` `onError(Exception e)`
`void` `onMessage(ByteBuffer bytes)`
`void` `onMessage(String message)`
`void` `onOpen(org.java_websocket.handshake.ServerHandshake serverHandshake)`
`boolean` `reconnectBlocking()`
`boolean` `reconnectBlockingWithoutRetry()`
`void` `setBinaryMessageHandler(Consumer<ByteBuffer> binaryMessageHandler)`
`void` `setTextMessageHandler(Consumer<String> textMessageHandler)`
`void` `shutdown()`

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

`addHeader, clearHeaders, close, close, close, closeBlocking, closeConnection, connect, connectBlocking, connectBlocking, getAttachment, getConnection, getConnections, getDraft, getLocalSocketAddress, getLocalSocketAddress, getProtocol, getReadyState, getRemoteSocketAddress, getRemoteSocketAddress, getResourceDescriptor, getSocket, getSSLSession, getURI, hasBufferedData, hasSSLSupport, isClosed, isClosing, isFlushAndClose, isOpen, onCloseInitiated, onClosing, onSetSSLParameters, onWebsocketClose, onWebsocketCloseInitiated, onWebsocketClosing, onWebsocketError, onWebsocketMessage, onWebsocketMessage, onWebsocketOpen, onWriteDemand, reconnect, removeHeader, run, send, send, send, sendFragmentedFrame, sendFrame, sendFrame, sendPing, setAttachment, setDnsResolver, setProxy, setSocket, setSocketFactory`

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

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

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

`onPreparePing, onWebsocketHandshakeReceivedAsClient, onWebsocketHandshakeReceivedAsServer, onWebsocketHandshakeSentAsClient, onWebsocketPing, onWebsocketPong`

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

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

### Methods inherited from interface java.lang.AutoCloseable

`close`

### Constructor Detail

#### WSClient

    public WSClient(URI serverUri,
                    Transport transport,
                    ConnectionParam connectionParam,
                    WSFunction function)

create websocket connection client

Parameters:
  `serverUri` - connection url

### Method Detail

#### setTextMessageHandler

    public void setTextMessageHandler(Consumer<String> textMessageHandler)

#### setBinaryMessageHandler

    public void setBinaryMessageHandler(Consumer<ByteBuffer> binaryMessageHandler)

#### onOpen

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

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

#### onMessage

    public void onMessage(String message)

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

#### onMessage

    public void onMessage(ByteBuffer bytes)

Overrides:
  `onMessage` in class `org.java_websocket.client.WebSocketClient`

#### onClose

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

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

#### onError

    public void onError(Exception e)

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

#### shutdown

    public void shutdown()

#### reconnectBlockingWithoutRetry

    public boolean reconnectBlockingWithoutRetry()
                                          throws InterruptedException

Throws:
  `InterruptedException`

#### reconnectBlocking

    public boolean reconnectBlocking()

Overrides:
  `reconnectBlocking` in class `org.java_websocket.client.WebSocketClient`

#### getInstance

    public static WSClient getInstance(ConnectionParam params,
                                       WSFunction function,
                                       Transport transport)
                                throws SQLException

Throws:
  `SQLException`