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