Sha256: 6aba4a1b5c644dc1c27123792d45f6dd9f579d1dbdb83bc891ed6b57d32fb4bc

Contents?: true

Size: 557 Bytes

Versions: 1

Compression:

Stored size: 557 Bytes

Contents

require 'json'

module Faye
  module Authentication
    class HTTPClient

      def self.publish(url, channel, data, key)
        uri = URI(url)
        req = Net::HTTP::Post.new(uri.request_uri)
        message = {'channel' => channel, 'clientId' => 'http'}
        message['signature'] = Faye::Authentication.sign(message, key)
        message['data'] = data
        req.set_form_data(message: JSON.dump(message))
        Net::HTTP.start(uri.hostname, uri.port, :use_ssl => uri.scheme == 'https') { |http| http.request(req) }
      end

    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
faye-authentication-1.8.1 lib/faye/authentication/http_client.rb