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 TypeMethodDescriptionvoid
addConnectionStatusConsumer
(BiConsumer<U, org.openremote.model.asset.agent.ConnectionStatus> connectionStatusConsumer) Add a consumer of client connection status changesvoid
addConnectionStatusConsumer
(Consumer<org.openremote.model.asset.agent.ConnectionStatus> connectionStatusConsumer) Add a consumer of server connection status changesvoid
addMessageConsumer
(IOServer.IoServerMessageConsumer<T, U, V> messageConsumer) Add a consumer of received messagesvoid
disconnectClient
(U client) Forcibly close the connection to a clientorg.openremote.model.asset.agent.ConnectionStatus
Get current connection status of the serverorg.openremote.model.asset.agent.ConnectionStatus
getConnectionStatus
(U client) Get current connection status of a client (eitherConnectionStatus.CONNECTED
orConnectionStatus.DISCONNECTED
)void
Remove every consumer of connection statusvoid
Remove every consumer of received messagesvoid
removeConnectionStatusConsumer
(BiConsumer<U, org.openremote.model.asset.agent.ConnectionStatus> connectionStatusConsumer) Remove a consumer of client connection status changesvoid
removeConnectionStatusConsumer
(Consumer<org.openremote.model.asset.agent.ConnectionStatus> connectionStatusConsumer) Remove a consumer of server connection status changesvoid
removeMessageConsumer
(IOServer.IoServerMessageConsumer<T, U, V> messageConsumer) Remove a consumer of received messagesvoid
sendMessage
(T message) Send a message to all clientsvoid
sendMessage
(T message, U client) Send a message to a clientvoid
start()
Start the servervoid
stop()
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.CONNECTED
orConnectionStatus.DISCONNECTED
) -
disconnectClient
Forcibly close the connection to a client -
start
void start()Start the server -
stop
void stop()Stop the server
-