Package eu.ill.webx.relay
Class WebXRelay
java.lang.Object
eu.ill.webx.relay.WebXRelay
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 Summary
Modifier and TypeMethodDescriptionconnectToHost(WebXHostConfiguration configuration) Connects to a WebX Host (if a connection hasn't already been made).static WebXRelayReturns the singleton instancevoidonClientDisconnect(WebXHost host) Called when a client disconnects so that we can perform cleanup operations (close the host connection if no clients are connected)
-
Method Details
-
getInstance
Returns the singleton instance- Returns:
- the singleton WebXRelay instance
-
connectToHost
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
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
-