Interface WebSocketAdapter
-
public interface WebSocketAdapterBasic websocket application interface facilitating different provider implementations. See implementation documentation to understand specific configuration options.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Promise<Void,Exception>close()Close theWebSocketAdapter.Promise<Void,IOException>sendObject(Object request)Send the supplied request over the websocket to the remote party.Promise<Void,Exception>start(Runnable onDisconnectionHandler, Consumer<JsonValue> onMessageConsumer)Start the websocket client and connect to the remote endpoint.
-
-
-
Method Detail
-
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
Promise<Void,Exception> close()
Close theWebSocketAdapter. 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:
Promiseof anyIOExceptionthat occurred in the event of a send failure
-
-