Class WebXRelay

java.lang.Object
eu.ill.webx.relay.WebXRelay

public class WebXRelay extends Object
Central creation and storage of WebXHosts. The WebX Tunnel uses the relay to connect to hosts and to indicate when a client connects (so that cleanup can be performed). The WebXRelay is a singleton class.
  • Method Details

    • getInstance

      public static WebXRelay getInstance()
      Returns the singleton instance
      Returns:
      the singleton WebXRelay instance
    • connectToHost

      public WebXHost connectToHost(WebXHostConfiguration configuration) throws WebXConnectionException
      Connects to a WebX Host (if a connection hasn't already been made). The host will obtain connection ports from the client connector socket and connect all ZMQ sockets to the server (either the WebX Router or a standalone WebX Engine)
      Parameters:
      configuration - The host configuration (hostname, client connector port, standalone)
      Returns:
      a WebXHost
      Throws:
      WebXConnectionException - thrown if the connection fails
    • onClientDisconnect

      public void onClientDisconnect(WebXHost host)
      Called when a client disconnects so that we can perform cleanup operations (close the host connection if no clients are connected)
      Parameters:
      host - the WebXHost instance