Class WebSocketTransport
- java.lang.Object
- 
- jadex.platform.service.message.websockettransport.WebSocketTransport
 
- 
- All Implemented Interfaces:
- ITransport<IWebSocketConnection>
 
 public class WebSocketTransport extends java.lang.Object implements ITransport<IWebSocketConnection> Transport implementing communication using web sockets.
- 
- 
Field SummaryFields Modifier and Type Field Description protected WebSocketTransportAgenthandlerConnection handler.protected static intPRIORITYprotected WebSocketServerserverThe server for incoming connections.
 - 
Constructor SummaryConstructors Constructor Description WebSocketTransport()
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcloseConnection(IWebSocketConnection con)Perform close operations on a connection.IFuture<IWebSocketConnection>createConnection(java.lang.String address, IComponentIdentifier target)Create a connection to a given address.java.lang.StringgetProtocolName()Get the protocol name.voidinit(ITransportHandler<IWebSocketConnection> handler)Initialize the transport.IFuture<java.lang.Integer>openPort(int port)Open a port to accept connections.IFuture<java.lang.Integer>sendMessage(IWebSocketConnection con, byte[] header, byte[] body)Send bytes using the given connection.voidshutdown()Shutdown and free all resources.
 
- 
- 
- 
Field Detail- 
PRIORITYprotected static final int PRIORITY - See Also:
- Constant Field Values
 
 - 
handlerprotected WebSocketTransportAgent handler Connection handler.
 - 
serverprotected WebSocketServer server The server for incoming connections.
 
- 
 - 
Method Detail- 
initpublic void init(ITransportHandler<IWebSocketConnection> handler) Initialize the transport. To be called once, before any other method.- Specified by:
- initin interface- ITransport<IWebSocketConnection>
- Parameters:
- handler- The transport handler with callback methods.
 
 - 
shutdownpublic void shutdown() Shutdown and free all resources. To be called once, as last method.- Specified by:
- shutdownin interface- ITransport<IWebSocketConnection>
 
 - 
getProtocolNamepublic java.lang.String getProtocolName() Get the protocol name.- Specified by:
- getProtocolNamein interface- ITransport<IWebSocketConnection>
 
 - 
openPortpublic IFuture<java.lang.Integer> openPort(int port) Open a port to accept connections.- Specified by:
- openPortin interface- ITransport<IWebSocketConnection>
- Parameters:
- port- The (positive) port or 0 for any port.
- Returns:
- A future holding the actual port, once the server is running.
 
 - 
createConnectionpublic IFuture<IWebSocketConnection> createConnection(java.lang.String address, IComponentIdentifier target) Create a connection to a given address.- Specified by:
- createConnectionin interface- ITransport<IWebSocketConnection>
- Parameters:
- address- The target platform's address.
- target- The target identifier to maybe perform authentication of the connection.
- Returns:
- A future containing the connection when succeeded.
 
 - 
closeConnectionpublic void closeConnection(IWebSocketConnection con) Perform close operations on a connection. Potentially cleans up key attachments as well.- Specified by:
- closeConnectionin interface- ITransport<IWebSocketConnection>
 
 - 
sendMessagepublic IFuture<java.lang.Integer> sendMessage(IWebSocketConnection con, byte[] header, byte[] body) Send bytes using the given connection.- Specified by:
- sendMessagein interface- ITransport<IWebSocketConnection>
- Parameters:
- sc- The connection.
- header- The message header.
- body- The message body.
- Returns:
- A future indicating success.
 
 
- 
 
-