Class WebXSession

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

public class WebXSession extends Object
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 Details

    • getSessionId

      public SessionId 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

      public WebXClient createClient(ClientIdentifier clientIdentifier)
      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

      public void onClientDisconnected(WebXClient client)
      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