Package eu.ill.webx.relay
Class WebXSession
java.lang.Object
eu.ill.webx.relay.WebXSession
Encapsulates a particular WebX X11 session, identified by a unique sessionId.
Manages filtering of messages to groups of clients or specific clients in the session.
Pinging of sessions delegated to WebXSessionValidator.
-
Method Summary
Modifier and TypeMethodDescriptioncreateClient(ClientIdentifier clientIdentifier) Creates a new WebXClient object with a unique Client Identifier and adds it to the clients list.intReturns the number of connected clients to the sessionReturns the session IdvoidonClientDisconnected(WebXClient client) Called when a client disconnects.voidonMessage(byte[] messageData) Called when the WebX Engine for this session has sent a message.voidsendInstruction(byte[] instructionData) Sends a binary instruction to the transport layervoidstart()Starts the session validator thread (pings the session - either to the WebX Engine or via the WebX Router - to ensure it is running correctly)voidstop()Stops the session validator thread and waits for it to join.
-
Method Details
-
getSessionId
Returns the session Id- Returns:
- the session Id
-
start
public void start()Starts the session validator thread (pings the session - either to the WebX Engine or via the WebX Router - to ensure it is running correctly) -
stop
public void stop()Stops the session validator thread and waits for it to join. -
createClient
Creates a new WebXClient object with a unique Client Identifier and adds it to the clients list.- Parameters:
clientIdentifier- the unique Client Identifier- Returns:
- a WebXClient object
-
onClientDisconnected
Called when a client disconnects. Removes the client from the clients list.- Parameters:
client- the client that has disconnected
-
getClientCount
public int getClientCount()Returns the number of connected clients to the session- Returns:
- the number of connected clients to the session
-
sendInstruction
public void sendInstruction(byte[] instructionData) Sends a binary instruction to the transport layer- Parameters:
instructionData- the binary instruction data
-
onMessage
public void onMessage(byte[] messageData) Called when the WebX Engine for this session has sent a message. The message contains a client index mask which is used to filter specific clients to which the message is destined.- Parameters:
messageData- The raw binary message data
-