Package adams.flow.websocket.client
Class SimpleSend
- java.lang.Object
-
- com.pusher.java_websocket.WebSocketAdapter
-
- com.pusher.java_websocket.client.WebSocketClient
-
- adams.flow.websocket.client.SimpleSend
-
- All Implemented Interfaces:
FlowContextHandler
,com.pusher.java_websocket.WebSocket
,com.pusher.java_websocket.WebSocketListener
,Runnable
public class SimpleSend extends com.pusher.java_websocket.client.WebSocketClient implements FlowContextHandler
Simple client for sending messages.- Version:
- $Revision$
- Author:
- FracPete (fracpete at waikato dot ac dot nz)
-
-
Field Summary
Fields Modifier and Type Field Description protected Actor
m_FlowContext
the flow context.protected Logger
m_Logger
for logging purposes.
-
Constructor Summary
Constructors Constructor Description SimpleSend(URI serverURI, Logger logger)
Initializes the client with the specified URI.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Actor
getFlowContext()
Returns the flow context, if any.protected Logger
getLogger()
Returns the logger instance to use.void
onClose(int code, String reason, boolean remote)
On closing the connection.void
onError(Exception ex)
In case of an error.void
onMessage(String message)
When receiving a message.void
onOpen(com.pusher.java_websocket.handshake.ServerHandshake handshakedata)
On opening the connection.void
setFlowContext(Actor value)
Sets the flow context.-
Methods inherited from class com.pusher.java_websocket.client.WebSocketClient
close, close, close, closeBlocking, closeConnection, connect, connectBlocking, getConnection, getDraft, getLocalSocketAddress, getLocalSocketAddress, getReadyState, getRemoteSocketAddress, getRemoteSocketAddress, getResourceDescriptor, getURI, hasBufferedData, isClosed, isClosing, isConnecting, isFlushAndClose, isOpen, onCloseInitiated, onClosing, onFragment, onMessage, onWebsocketClose, onWebsocketCloseInitiated, onWebsocketClosing, onWebsocketError, onWebsocketMessage, onWebsocketMessage, onWebsocketMessageFragment, onWebsocketOpen, onWriteDemand, run, send, send, send, sendFragmentedFrame, sendFrame, setProxy, setSocket
-
-
-
-
Method Detail
-
setFlowContext
public void setFlowContext(Actor value)
Sets the flow context.- Specified by:
setFlowContext
in interfaceFlowContextHandler
- Parameters:
value
- the actor
-
getFlowContext
public Actor getFlowContext()
Returns the flow context, if any.- Specified by:
getFlowContext
in interfaceFlowContextHandler
- Returns:
- the actor, null if none available
-
getLogger
protected Logger getLogger()
Returns the logger instance to use.- Returns:
- the logger
-
onOpen
public void onOpen(com.pusher.java_websocket.handshake.ServerHandshake handshakedata)
On opening the connection.- Specified by:
onOpen
in classcom.pusher.java_websocket.client.WebSocketClient
- Parameters:
handshakedata
- the handshake
-
onMessage
public void onMessage(String message)
When receiving a message.- Specified by:
onMessage
in classcom.pusher.java_websocket.client.WebSocketClient
- Parameters:
message
- the message
-
onClose
public void onClose(int code, String reason, boolean remote)
On closing the connection.- Specified by:
onClose
in classcom.pusher.java_websocket.client.WebSocketClient
- Parameters:
code
- the codereason
- the reasonremote
- whether remote
-
onError
public void onError(Exception ex)
In case of an error.- Specified by:
onError
in classcom.pusher.java_websocket.client.WebSocketClient
- Parameters:
ex
- the exception
-
-