Class WebSocketConnectionServer
- java.lang.Object
- 
- jadex.platform.service.message.websockettransport.AWebsocketConnection
- 
- jadex.platform.service.message.websockettransport.WebSocketConnectionServer
 
 
- 
- All Implemented Interfaces:
- IWebSocketConnection
 
 public class WebSocketConnectionServer extends AWebsocketConnection Server-side websocket implemented using nanohttpd.
- 
- 
Field SummaryFields Modifier and Type Field Description protected java.net.SocketsocketThe low-level socket.protected fi.iki.elonen.NanoWSD.WebSocketwebsocketThe web socket.- 
Fields inherited from class jadex.platform.service.message.websockettransport.AWebsocketConnectionbytesreceived, handler, hasheader, header, maxmsgsize, NULL_MSG_COMMAND, pojoagent
 
- 
 - 
Constructor SummaryConstructors Constructor Description WebSocketConnectionServer(fi.iki.elonen.NanoHTTPD.IHTTPSession handshakerequest, ITransportHandler<IWebSocketConnection> handlr, java.net.Socket acceptsocket)Creates the websocket.
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()Closes the connection (ignored if already closed).voidforceClose()Forcibly closes the connection (ignored if already closed).fi.iki.elonen.NanoWSD.WebSocketgetWebSocket()Returns the raw server web socket.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
 
- 
 
- 
- 
- 
Constructor Detail- 
WebSocketConnectionServerpublic WebSocketConnectionServer(fi.iki.elonen.NanoHTTPD.IHTTPSession handshakerequest, ITransportHandler<IWebSocketConnection> handlr, java.net.Socket acceptsocket)Creates the websocket.
 
- 
 - 
Method Detail- 
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).
 - 
getWebSocketpublic fi.iki.elonen.NanoWSD.WebSocket getWebSocket() Returns the raw server web socket.- Returns:
- The raw server web socket.
 
 - 
sendAsFramesprotected void sendAsFrames(byte[] data) throws java.io.IOExceptionFragment and send data as websocket frames.- Parameters:
- data- The data.
- Throws:
- java.io.IOException- On communication failure.
 
 
- 
 
-