Interface WebSocketAdapter
-
public interface WebSocketAdapter
Basic 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:
Promise
holding theWebSocketAdapter
and anyException
thrown when trying to start the connection. the promise can fail withSSLException
in case of SSL Exception orAuthenticationException
in 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:
Promise
of anyIOException
that occurred in the event of a send failure
-
-