Package com.flashphoner.fpwcsapi.ws
Class WebSocketChannelClient
java.lang.Object
com.flashphoner.fpwcsapi.ws.WebSocketChannelClient
Implementation of Websocket client
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected classWebSocketObserver is a callback on Websocket session state onOpen() onClose() onTextMessage()protected static enumFour Websocket connection states -
Constructor Summary
ConstructorsConstructorDescriptionWebSocketChannelClient(WebSocketChannelEvents events, LooperExecutor executor) New WebSocketChannelClient -
Method Summary
Modifier and TypeMethodDescriptionvoidaddCustomHeader(Map<String, String> customHeaders) voidconnect(SessionOptions sessionOptions) Connect passed wsUrl with default timeout 4000 msvoiddisconnect(boolean waitForComplete) Disconnect current Websocket sessionvoidExecute a Websocket command.voidExecute a Websocket command.getState()
-
Constructor Details
-
WebSocketChannelClient
New WebSocketChannelClient- Parameters:
events- callback
-
-
Method Details
-
getState
-
connect
Connect passed wsUrl with default timeout 4000 ms- Parameters:
sessionOptions-
-
addCustomHeader
-
execute
Execute a Websocket command. Example: webSocketChannelClient.execute("pong");- Parameters:
command-
-
execute
Execute a Websocket command.- Parameters:
command- name of the commanddata- object passed to the Websocket command
-
disconnect
public void disconnect(boolean waitForComplete) Disconnect current Websocket session- Parameters:
waitForComplete- if true, waiting for closeEvent @see WebSocketChannelClient#onClose
-