Interface IOServer<T,U,V extends SocketAddress>

Type Parameters:
T - Defines the message type that the server can send/receive
U - Defines the client identifier type that can be used to uniquely identify clients connected to this server
V - 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>.

  • Method Details

    • sendMessage

      void sendMessage(T message, U client)
      Send a message to a client
    • sendMessage

      void sendMessage(T message)
      Send a message to all clients
    • addMessageConsumer

      void addMessageConsumer(IOServer.IoServerMessageConsumer<T,U,V> messageConsumer)
      Add a consumer of received messages
    • removeMessageConsumer

      void removeMessageConsumer(IOServer.IoServerMessageConsumer<T,U,V> messageConsumer)
      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

      org.openremote.model.asset.agent.ConnectionStatus getConnectionStatus(U client)
      Get current connection status of a client (either ConnectionStatus.CONNECTED or ConnectionStatus.DISCONNECTED)
    • disconnectClient

      void disconnectClient(U client)
      Forcibly close the connection to a client
    • start

      void start()
      Start the server
    • stop

      void stop()
      Stop the server