lib/turntabler/connection.rb
def publish(params)
      params[:msgid] = message_id = next_message_id
      params = @default_params.merge(params)

      logger.debug "Message sent: #{params.inspect}"

      if HTTP_APIS.include?(params[:api])
        publish_to_http(params)
      else
        publish_to_socket(params)
      end

      # Add timeout handler
      EventMachine.add_timer(@timeout) do
        dispatch('msgid' => message_id, 'command' => 'response_received', 'error' => 'timed out')
      end if @timeout

      message_id
    end
def publish(params)
      params[:msgid] = message_id = next_message_id
      params = @default_params.merge(params)

      logger.debug "Message sent: #{params.inspect}"

      if HTTP_APIS.include?(params[:api])
        publish_to_http(params)
      else
        publish_to_socket(params)
      end

      # Add timeout handler
      EventMachine.add_timer(@timeout) do
        dispatch('msgid' => message_id, 'command' => 'response_received', 'error' => 'timed out')
      end if @timeout

      message_id
    end
def publish ( params ) params [ :msgid ] = message_id = next_message_id params = @default_params . merge ( params ) logger . debug "Message sent: #{params.inspect}" if HTTP_APIS . include? ( params [ :api ] ) publish_to_http ( params ) else publish_to_socket ( params ) end # Add timeout handler EventMachine . add_timer ( @timeout ) do dispatch ( 'msgid' => message_id , 'command' => 'response_received' , 'error' => 'timed out' ) end if @timeout message_id end
Publishes the given params to the underlying web socket.  The defaults
 initially configured as part of the connection will also be included in
 the message.

 @param [Hash] params The parameters to include in the message sent
 @return [Fixnum] The id of the message delivered
Publishes the given params to the underlying web socket . The defaults initially configured as part of the connection will also be included in the message .