Class WsPool

java.lang.Object
org.basex.http.ws.WsPool

public final class WsPool extends Object
This class defines a pool for WebSockets. It manages all connected WebSockets.
Author:
BaseX Team 2005-21, BSD License, Johannes Finckh
  • Method Details

    • ids

      public static TokenList ids()
      Returns the ids of all connected clients.
      Returns:
      client ids
    • emit

      public static void emit(Value message) throws QueryException
      Sends a message to all connected clients.
      Parameters:
      message - message
      Throws:
      QueryException - query exception
    • broadcast

      public static void broadcast(Value message, String client) throws QueryException
      Sends a message to all connected clients except to the one with the given id.
      Parameters:
      message - message
      client - client id
      Throws:
      QueryException - query exception
    • send

      public static void send(Value message, String... ids) throws QueryException
      Sends a message to a specific clients.
      Parameters:
      message - message
      ids - client ids
      Throws:
      QueryException - query exception
    • get

      public static WebSocket get(String id)
      Returns the client with the specified id.
      Parameters:
      id - client id
      Returns:
      client