Class WebsocketConnectionClient2
- java.lang.Object
-
- jadex.platform.service.message.websockettransport.AWebsocketConnection
-
- jadex.platform.service.message.websockettransport.WebsocketConnectionClient2
-
- All Implemented Interfaces:
IWebSocketConnection
public class WebsocketConnectionClient2 extends AWebsocketConnection
-
-
Field Summary
Fields Modifier and Type Field Description protected java.lang.String
address
The connection address.protected org.java_websocket.client.WebSocketClient
wsclient
The websocket client.-
Fields inherited from class jadex.platform.service.message.websockettransport.AWebsocketConnection
bytesreceived, handler, hasheader, header, maxmsgsize, NULL_MSG_COMMAND, pojoagent
-
-
Constructor Summary
Constructors Constructor Description WebsocketConnectionClient2(java.lang.String address, IComponentIdentifier target, ITransportHandler<IWebSocketConnection> handler)
Creates the connection.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
Closes the connection (ignored if already closed).IFuture<IWebSocketConnection>
connect()
Establishes the connection.void
forceClose()
Forcibly closes the connection (ignored if already closed).protected IFuture<java.lang.Void>
sendAsFrames(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.AWebsocketConnection
handleMessagePayload
-
-
-
-
Constructor Detail
-
WebsocketConnectionClient2
public WebsocketConnectionClient2(java.lang.String address, IComponentIdentifier target, ITransportHandler<IWebSocketConnection> handler)
Creates the connection.- Parameters:
address
- Target address.target
- Target platform.
-
-
Method Detail
-
connect
public IFuture<IWebSocketConnection> connect()
Establishes the connection.- Returns:
- This object when done, exception on connection error.
-
sendMessage
public IFuture<java.lang.Integer> sendMessage(byte[] header, byte[] body)
Description copied from interface:IWebSocketConnection
Send bytes using the connection.- Parameters:
header
- The message header.body
- The message body.- Returns:
- A future indicating success.
-
close
public void close()
Description copied from interface:IWebSocketConnection
Closes the connection (ignored if already closed).
-
forceClose
public void forceClose()
Description copied from interface:IWebSocketConnection
Forcibly closes the connection (ignored if already closed).
-
sendAsFrames
protected IFuture<java.lang.Void> sendAsFrames(byte[] data)
Fragment and send data as websocket frames.- Parameters:
data
- The data.fut
- The future.
-
-