Package com.flashphoner.fpwcsapi.ws
Class WebSocketChannelClient
java.lang.Object
com.flashphoner.fpwcsapi.ws.WebSocketChannelClient
Implementation of Websocket client
-
Constructor Summary
ConstructorDescriptionWebSocketChannelClient
(WebSocketChannelEvents events, LooperExecutor executor) New WebSocketChannelClient -
Method Summary
Modifier and TypeMethodDescriptionvoid
addCustomHeader
(Map<String, String> customHeaders) void
connect
(SessionOptions sessionOptions) Connect passed wsUrl with default timeout 4000 msvoid
disconnect
(boolean waitForComplete) Disconnect current Websocket sessionvoid
Execute a Websocket command.void
Execute a Websocket command.com.flashphoner.fpwcsapi.ws.WebSocketChannelClient.WebSocketConnectionState
getState()
-
Constructor Details
-
WebSocketChannelClient
New WebSocketChannelClient- Parameters:
events
- callback
-
-
Method Details
-
getState
public com.flashphoner.fpwcsapi.ws.WebSocketChannelClient.WebSocketConnectionState 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
-