Interface WebsocketConnection
- All Superinterfaces:
AttributeAware
Interface for a websocket connection.
- Since:
- 1
- Version:
- 1
-
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Close the connection.getId()Return the connection id.Return the registered message handler.Return the client ip address for the websocket.voidsendMessage(String msg) Send a message to the associated client.voidsetMsgHandler(WebsocketMsgHandler handler) Set the message handler to use for incoming messages.Methods inherited from interface com.kosdev.kos.commons.util.AttributeAware
getAttribute, removeAttribute, setAttribute
-
Method Details
-
getId
String getId()Return the connection id.- Returns:
- the unique connection id
- Since:
- 1
-
sendMessage
Send a message to the associated client.- Parameters:
msg- the message to send- Since:
- 1
-
close
void close()Close the connection.- Since:
- 1
-
getRemoteAddr
InetSocketAddress getRemoteAddr()Return the client ip address for the websocket.- Returns:
- the client address
- Since:
- 1
-
getMsgHandler
WebsocketMsgHandler getMsgHandler()Return the registered message handler.- Since:
- 1
-
setMsgHandler
Set the message handler to use for incoming messages.- Since:
- 1
-