def action(data)
      data.deep_symbolize_keys!

      publication = data[:publication]
      channel_options = @ChannelPublications[publication]
      if channel_options
        model = channel_options[:model]
        model_options = model.ChannelPublications[publication]
        params = data[:params]
        command = data[:command]

        action_params = {
          publication: publication,
          model: model,
          model_options: model_options,
          options: channel_options,
          params: params,
          command: command
        }

        case command
        when "fetch"
          fetch(action_params)
        when "create"
          create(action_params)
        when "update"
          update(action_params)
        when "destroy"
          destroy(action_params)
        end
      else
        response = {
          publication: publication,
          msg: 'error',
          command: command,
          error: "Stream for publication '#{publication}' does not exist in channel '#{self.channel_name}'."
        }

        # Send error notification to the client
        transmit response
      end
    end
def action(data)
      data.deep_symbolize_keys!

      publication = data[:publication]
      channel_options = @ChannelPublications[publication]
      if channel_options
        model = channel_options[:model]
        model_options = model.ChannelPublications[publication]
        params = data[:params]
        command = data[:command]

        action_params = {
          publication: publication,
          model: model,
          model_options: model_options,
          options: channel_options,
          params: params,
          command: command
        }

        case command
        when "fetch"
          fetch(action_params)
        when "create"
          create(action_params)
        when "update"
          update(action_params)
        when "destroy"
          destroy(action_params)
        end
      else
        response = {
          publication: publication,
          msg: 'error',
          command: command,
          error: "Stream for publication '#{publication}' does not exist in channel '#{self.channel_name}'."
        }

        # Send error notification to the client
        transmit response
      end
    end
Public methods


 Process actions sent from the client

 @param [Hash] data Contains command to be executed and its parameters
 {
   "publication": "model.model_name.name"
   "command": "fetch"
   "params": {}
 }