Class WebSocketConnectionClient
- java.lang.Object
- 
- jadex.platform.service.message.websockettransport.AWebsocketConnection
- 
- jadex.platform.service.message.websockettransport.WebSocketConnectionClient
 
 
- 
- All Implemented Interfaces:
- IWebSocketConnection
 
 public class WebSocketConnectionClient extends AWebsocketConnection Client-side websocket connection.
- 
- 
Field SummaryFields Modifier and Type Field Description protected java.lang.StringaddressThe connection address.protected JadexExecutorServiceAdapterexecserviceAccess to daemon thread pool for WS APIprotected com.neovisionaries.ws.client.WebSocketwebsocketThe websocket.- 
Fields inherited from class jadex.platform.service.message.websockettransport.AWebsocketConnectionbytesreceived, handler, hasheader, header, maxmsgsize, NULL_MSG_COMMAND, pojoagent
 
- 
 - 
Constructor SummaryConstructors Constructor Description WebSocketConnectionClient(java.lang.String address, IComponentIdentifier target, ITransportHandler<IWebSocketConnection> handler)Creates the connection.
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()Closes the connection (ignored if already closed).IFuture<IWebSocketConnection>connect()Establishes the connection.voidforceClose()Forcibly closes the connection (ignored if already closed).protected voidsendAsFrames(byte[] data)Fragment and send data as websocket frames.IFuture<java.lang.Integer>sendMessage(byte[] header, byte[] body)Send bytes using the connection.- 
Methods inherited from class jadex.platform.service.message.websockettransport.AWebsocketConnectionhandleMessagePayload
 
- 
 
- 
- 
- 
Field Detail- 
addressprotected java.lang.String address The connection address.
 - 
websocketprotected com.neovisionaries.ws.client.WebSocket websocket The websocket.
 - 
execserviceprotected JadexExecutorServiceAdapter execservice Access to daemon thread pool for WS API
 
- 
 - 
Constructor Detail- 
WebSocketConnectionClientpublic WebSocketConnectionClient(java.lang.String address, IComponentIdentifier target, ITransportHandler<IWebSocketConnection> handler)Creates the connection.- Parameters:
- address- Target address.
- target- Target platform.
 
 
- 
 - 
Method Detail- 
connectpublic IFuture<IWebSocketConnection> connect() Establishes the connection.- Returns:
- This object when done, exception on connection error.
 
 - 
sendMessagepublic IFuture<java.lang.Integer> sendMessage(byte[] header, byte[] body) Send bytes using the connection.- Parameters:
- header- The message header.
- body- The message body.
- Returns:
- A future indicating success.
 
 - 
closepublic void close() Closes the connection (ignored if already closed).
 - 
forceClosepublic void forceClose() Forcibly closes the connection (ignored if already closed).
 - 
sendAsFramesprotected void sendAsFrames(byte[] data) Fragment and send data as websocket frames.- Parameters:
- data- The data.
- fut- The future.
 
 
- 
 
-