All Superinterfaces:
RuntimeType.Api<WsClientConfig>
All Known Implementing Classes:
DirectWsClient

public interface WsClient extends RuntimeType.Api<WsClientConfig>
WebSocket client.
  • Field Details

  • Method Details

    • builder

      static WsClientConfig.Builder builder()
      A new fluent API builder to create new instances of client.
      Returns:
      a new builder
    • create

      static WsClient create(WsClientConfig clientConfig)
      Create a new WebSocket client with custom configuration.
      Parameters:
      clientConfig - websocket client configuration
      Returns:
      a new WebSocket client
    • create

      static WsClient create(Consumer<WsClientConfig.Builder> consumer)
      Create a new WebSocket client customizing its configuration.
      Parameters:
      consumer - websocket client configuration consumer
      Returns:
      a new WebSocket client
    • connect

      void connect(URI uri, WsListener listener)
      Starts a new WebSocket connection and runs it in a new virtual thread. This method returns when the connection is established and a new WsSession is started.
      Parameters:
      uri - URI to connect to
      listener - listener to handle WebSocket
    • connect

      void connect(String path, WsListener listener)
      Starts a new WebSocket connection and runs it in a new virtual thread. This method returns when the connection is established and a new WsSession is started.
      Parameters:
      path - path to connect to, if client uses a base URI, this is resolved against the base URI
      listener - listener to handle WebSocket