You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: subscriptions.rb
    path of file: ./repos/litecable/lib/lite_cable/connection
    
    the code of the file until where you have to start completion: # frozen_string_literal: true

module LiteCable
  class UnknownChannelError < StandardError
    attr_reader :channel_id

    def initialize(channel_id)
      @channel_id = channel_id
      super("Unknown channel: #{channel_id}")
    end
  end

  module Connection
    # Man
    
      def add(identifier, subscribe = true)
        raise AlreadySubscribedError if find(identifier)

        params = connection.coder.decode(identifier)

        channel_id = params.delete("channel")

        channel_class = LiteCable.channel_registry.lookup(channel_id)

        raise UnknownChannelError, channel_id unless channel_class

        subscriptions[identifier] = channel_class.new(connection, identifier, params)
        subscribe ? subscribe_channel(subscriptions[identifier]) : subscriptions[identifier]
      end