def connect(request, _unused_call)
      logger.debug("RPC Connect: #{request.inspect}")

      socket = build_socket(env: rack_env(request))

      connection = factory.call(socket)

      connection.handle_open

      if socket.closed?
        AnyCable::ConnectionResponse.new(status: AnyCable::Status::FAILURE)
      else
        AnyCable::ConnectionResponse.new(
          status: AnyCable::Status::SUCCESS,
          identifiers: connection.identifiers_json,
          transmissions: socket.transmissions
        )
      end
    rescue StandardError => exp
      notify_exception(exp, :connect, request)

      AnyCable::ConnectionResponse.new(
        status: AnyCable::Status::ERROR,
        error_msg: exp.message
      )
    end
def connect(request, _unused_call)
      logger.debug("RPC Connect: #{request.inspect}")

      socket = build_socket(env: rack_env(request))

      connection = factory.call(socket)

      connection.handle_open

      if socket.closed?
        AnyCable::ConnectionResponse.new(status: AnyCable::Status::FAILURE)
      else
        AnyCable::ConnectionResponse.new(
          status: AnyCable::Status::SUCCESS,
          identifiers: connection.identifiers_json,
          transmissions: socket.transmissions
        )
      end
    rescue StandardError => exp
      notify_exception(exp, :connect, request)

      AnyCable::ConnectionResponse.new(
        status: AnyCable::Status::ERROR,
        error_msg: exp.message
      )
    end
Handle connection request from WebSocket server