Interface WebSocketAdapter
public interface WebSocketAdapter
Basic websocket application interface facilitating different provider implementations. See implementation
documentation to understand specific configuration options.
-
Method Summary
Modifier and TypeMethodDescriptionclose()Close theWebSocketAdapter.sendObject(Object request) Send the supplied request over the websocket to the remote party.Start the websocket client and connect to the remote endpoint.
-
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:
Promiseholding theWebSocketAdapterand anyExceptionthrown when trying to start the connection. the promise can fail withSSLExceptionin case of SSL Exception orAuthenticationExceptionin case of an authentication exception.
-
close
Close theWebSocketAdapter. This is a mandatory operation.- Returns:
- The promise of closure.
-
sendObject
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:
Promiseof anyIOExceptionthat occurred in the event of a send failure
-