Package eu.ill.webx.relay
Class WebXHost
java.lang.Object
eu.ill.webx.relay.WebXHost
Provides connection to a WebXRouter or standalone WebXEngine.
WebXTransport management connections to the ZMQ sockets.
WebXHost manages all sessions that are in use on the host. Creation of sessions and connection/creation of clients is handled here.
-
Method Summary
Modifier and TypeMethodDescriptionvoidEnsures that there are no empty sessionsintReturns the total number of clients connectedReturns the hostnameintgetPort()Returns the principal (client connector) port of the hostonClientConnection(WebXClientConfiguration clientConfiguration) Called when a client connects.voidonClientDisconnected(WebXClient client) Called when a client disconnects.
-
Method Details
-
getHostname
Returns the hostname- Returns:
- the hostname
-
getPort
public int getPort()Returns the principal (client connector) port of the host- Returns:
- the host port
-
onClientConnection
public WebXClient onClientConnection(WebXClientConfiguration clientConfiguration) throws WebXConnectionException Called when a client connects. Depending on the connection type it will start a new session. In all cases the client is connected to WebX engine.- Parameters:
clientConfiguration- The client connection configuration- Returns:
- a new WebX client
- Throws:
WebXConnectionException- thrown if the connection fails
-
onClientDisconnected
Called when a client disconnects. The client is disconnected in the WebX engine. The session will be removed if it is empty.- Parameters:
client- the WebX client
-
getClientCount
public int getClientCount()Returns the total number of clients connected- Returns:
- the number of clients connected
-
cleanupSessions
public void cleanupSessions()Ensures that there are no empty sessions
-