public class StringWebSocketClient extends WebSocketClient implements CanHandleMessages<java.lang.String>, CanHandleErrors, CanHandleConnects, CanHandleDisconnects
| Constructor and Description |
|---|
StringWebSocketClient() |
| Modifier and Type | Method and Description |
|---|---|
void |
connect(java.net.URI endpoint)
Connects web socket client.
|
java.util.List<java.lang.Runnable> |
getConnectionHandlers()
Returns a list of all registered web socket connection handlers.
|
java.util.List<java.lang.Runnable> |
getDisconnectionHandlers()
Returns a list of all registered web socket disconnection handlers.
|
java.util.List<java.util.function.Consumer<java.lang.Throwable>> |
getErrorHandlers()
Returns a list of all registered web socket error handlers.
|
java.util.List<java.util.function.Consumer<java.lang.String>> |
getMessageHandlers()
Returns a list of all registered web socket messages handlers.
|
void |
onClose()
This event if fired when the client is
disconnected from a web socket.
|
void |
onError(java.lang.Throwable cause)
This event if fired when there is an unexpected
error in web socket connection.
|
void |
onMessage(java.lang.String message)
This event if fired when there is a
new message from the web socket.
|
void |
onOpen(javax.websocket.Session session)
This event if fired when the client is successfully
connected to a web socket.
|
void |
removeAllHandlers()
Remove all the registered handlers.
|
getEndpointclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitaddMessageHandler, removeMessageHandlersaddErrorHandler, removeErrorHandlersaddConnectionHandler, removeConnectionHandlersaddDisconnectionHandler, removeDisconnectionHandlerspublic void connect(java.net.URI endpoint)
WebSocketClientconnect in class WebSocketClientendpoint - The full address of an endpoint to connect to.
Usually starts with 'ws://'.public void onOpen(javax.websocket.Session session)
session - the actual web socket session instancepublic void onClose()
public void onError(java.lang.Throwable cause)
cause - the actual error reasonpublic void onMessage(java.lang.String message)
message - the actual message content.public java.util.List<java.util.function.Consumer<java.lang.String>> getMessageHandlers()
CanHandleMessagesgetMessageHandlers in interface CanHandleMessages<java.lang.String>public java.util.List<java.util.function.Consumer<java.lang.Throwable>> getErrorHandlers()
CanHandleErrorsgetErrorHandlers in interface CanHandleErrorspublic java.util.List<java.lang.Runnable> getConnectionHandlers()
CanHandleConnectsgetConnectionHandlers in interface CanHandleConnectspublic java.util.List<java.lang.Runnable> getDisconnectionHandlers()
CanHandleDisconnectsgetDisconnectionHandlers in interface CanHandleDisconnectspublic void removeAllHandlers()