Package org.openremote.agent.protocol.io
Interface IOServer<T,U,V extends SocketAddress>
- Type Parameters:
T- Defines the message type that the server can send/receiveU- Defines the client identifier type that can be used to uniquely identify clients connected to this serverV- Defines the client address that can be used to uniquely identify the client
- All Known Implementing Classes:
AbstractNettyIOServer,AbstractTCPServer,AbstractUDPServer,TCPStringServer,UDPStringServer
public interface IOServer<T,U,V extends SocketAddress>
Represents an IO server that accepts incoming clients.
Implementors are responsible for handling the low level communication and for providing consumers with a mechanism for encoding/decoding messages of type <T> received from source <U> with an address <V>.
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionvoidaddConnectionStatusConsumer(BiConsumer<U, org.openremote.model.asset.agent.ConnectionStatus> connectionStatusConsumer) Add a consumer of client connection status changesvoidaddConnectionStatusConsumer(Consumer<org.openremote.model.asset.agent.ConnectionStatus> connectionStatusConsumer) Add a consumer of server connection status changesvoidaddMessageConsumer(IOServer.IoServerMessageConsumer<T, U, V> messageConsumer) Add a consumer of received messagesvoiddisconnectClient(U client) Forcibly close the connection to a clientorg.openremote.model.asset.agent.ConnectionStatusGet current connection status of the serverorg.openremote.model.asset.agent.ConnectionStatusgetConnectionStatus(U client) Get current connection status of a client (eitherConnectionStatus.CONNECTEDorConnectionStatus.DISCONNECTED)voidRemove every consumer of connection statusvoidRemove every consumer of received messagesvoidremoveConnectionStatusConsumer(BiConsumer<U, org.openremote.model.asset.agent.ConnectionStatus> connectionStatusConsumer) Remove a consumer of client connection status changesvoidremoveConnectionStatusConsumer(Consumer<org.openremote.model.asset.agent.ConnectionStatus> connectionStatusConsumer) Remove a consumer of server connection status changesvoidremoveMessageConsumer(IOServer.IoServerMessageConsumer<T, U, V> messageConsumer) Remove a consumer of received messagesvoidsendMessage(T message) Send a message to all clientsvoidsendMessage(T message, U client) Send a message to a clientvoidstart()Start the servervoidstop()Stop the server
-
Method Details
-
sendMessage
Send a message to a client -
sendMessage
Send a message to all clients -
addMessageConsumer
Add a consumer of received messages -
removeMessageConsumer
Remove a consumer of received messages -
removeAllMessageConsumers
void removeAllMessageConsumers()Remove every consumer of received messages -
addConnectionStatusConsumer
void addConnectionStatusConsumer(Consumer<org.openremote.model.asset.agent.ConnectionStatus> connectionStatusConsumer) Add a consumer of server connection status changes -
removeConnectionStatusConsumer
void removeConnectionStatusConsumer(Consumer<org.openremote.model.asset.agent.ConnectionStatus> connectionStatusConsumer) Remove a consumer of server connection status changes -
addConnectionStatusConsumer
void addConnectionStatusConsumer(BiConsumer<U, org.openremote.model.asset.agent.ConnectionStatus> connectionStatusConsumer) Add a consumer of client connection status changes -
removeConnectionStatusConsumer
void removeConnectionStatusConsumer(BiConsumer<U, org.openremote.model.asset.agent.ConnectionStatus> connectionStatusConsumer) Remove a consumer of client connection status changes -
removeAllConnectionStatusConsumers
void removeAllConnectionStatusConsumers()Remove every consumer of connection status -
getConnectionStatus
org.openremote.model.asset.agent.ConnectionStatus getConnectionStatus()Get current connection status of the server -
getConnectionStatus
Get current connection status of a client (eitherConnectionStatus.CONNECTEDorConnectionStatus.DISCONNECTED) -
disconnectClient
Forcibly close the connection to a client -
start
void start()Start the server -
stop
void stop()Stop the server
-