Interface WebSocketAdapter


public interface WebSocketAdapter
Basic websocket application interface facilitating different provider implementations. See implementation documentation to understand specific configuration options.
  • Method Details

    • start

      Promise<Void,Exception> start(Runnable onDisconnectionHandler, Consumer<JsonValue> onMessageConsumer)
      Start the websocket client and connect to the remote endpoint.
      Parameters:
      onDisconnectionHandler - The handler to call on disconnection.
      onMessageConsumer - The handler to call on received message.
      Returns:
      Promise holding the WebSocketAdapter and any Exception thrown when trying to start the connection. the promise can fail with SSLException in case of SSL Exception or AuthenticationException in case of an authentication exception.
    • close

      Close the WebSocketAdapter. This is a mandatory operation.
      Returns:
      The promise of closure.
    • sendObject

      Promise<Void,IOException> sendObject(Object request)
      Send the supplied request over the websocket to the remote party. This method call will complete the promise with an exception when trying to send an object when the adapter is disconnected.
      Parameters:
      request - The request to transmit
      Returns:
      Promise of any IOException that occurred in the event of a send failure