Ejemplo n.º 1
0
  /**
   * Connects client to the scope
   *
   * @param conn Client conneciton
   * @param scope Scope
   * @param params Params passed from client side with connect call
   * @return true if client was registred within scope, false otherwise
   */
  public boolean connect(IConnection conn, IScope scope, Object[] params) {

    log.debug("Connect to core handler ?");

    // Get session id
    String id = conn.getSessionId();

    // Use client registry from scope the client connected to.
    IScope connectionScope = Red5.getConnectionLocal().getScope();

    // Get client registry for connection scope
    IClientRegistry clientRegistry = connectionScope.getContext().getClientRegistry();

    // Get client from registry by id or create a new one
    IClient client =
        clientRegistry.hasClient(id)
            ? clientRegistry.lookupClient(id)
            : clientRegistry.newClient(params);

    // We have a context, and a client object.. time to init the conneciton.
    conn.initialize(client);

    // we could checked for banned clients here
    return true;
  }