com.taosdata.jdbc.ws

## Class WSClient

- java.lang.Object
- - com.taosdata.jdbc.ws.WSClient

All Implemented Interfaces:
  AutoCloseable

    public class WSClient
    extends Object
    implements AutoCloseable

### Field Summary

Fields
`URI` `serverUri`

### Constructor Summary

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

### Method Summary

All Methods Static Methods Instance Methods Concrete Methods
`void` `close()`
`CompletableFuture<Void>` `closeAsync()` Async close WebSocket connection (non-blocking, returns CompletableFuture)
`void` `closeBlocking()`
`boolean` `connectBlocking()`
`CompletableFuture<io.netty.channel.Channel>` `getChannelAsync()`
`static WSClient` `getInstance(ConnectionParam params, int endpointIndex, WSFunction function)`
`static WSClient` `getSlaveInstance(ConnectionParam params, WSFunction function)`
`boolean` `isClosed()`
`boolean` `isOpen()`
`boolean` `reconnectBlocking()`
`void` `send(io.netty.buffer.ByteBuf binData)`
`void` `send(String strData)`

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

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

### Field Detail

#### serverUri

    public final URI serverUri

### Constructor Detail

#### WSClient

    public WSClient(URI serverUri,
                    ConnectionParam connectionParam)

create websocket connection client

Parameters:
  `serverUri` - connection url

### Method Detail

#### getChannelAsync

    public CompletableFuture<io.netty.channel.Channel> getChannelAsync()

#### isOpen

    public boolean isOpen()

#### isClosed

    public boolean isClosed()

#### close

    public void close()

Specified by:
  `close` in interface `AutoCloseable`

#### closeAsync

    public CompletableFuture<Void> closeAsync()

Async close WebSocket connection (non-blocking, returns CompletableFuture)

Returns:
  CompletableFuture for async result (no return on success; contains exception on failure)

#### connectBlocking

    public boolean connectBlocking()

#### reconnectBlocking

    public boolean reconnectBlocking()

#### send

    public void send(String strData)

#### send

    public void send(io.netty.buffer.ByteBuf binData)

#### closeBlocking

    public void closeBlocking()

#### getInstance

    public static WSClient getInstance(ConnectionParam params,
                                       int endpointIndex,
                                       WSFunction function)
                                throws SQLException

Throws:
  `SQLException`

#### getSlaveInstance

    public static WSClient getSlaveInstance(ConnectionParam params,
                                            WSFunction function)
                                     throws SQLException

Throws:
  `SQLException`