Sha256: 9a9ae2bbe4a39461c45267199837a92e827a6a05124d809b531cd1239057e1f4

Contents?: true

Size: 556 Bytes

Versions: 2

Compression:

Stored size: 556 Bytes

Contents

# frozen_string_literal: true

require "uri"

require "server_sent_events/version"
require "server_sent_events/client"
require "server_sent_events/parser"

module ServerSentEvents
  # Convenience method go the up-and running fast.
  #
  # In order to start listening to server events, this is all the code that we
  # need:
  #
  #     ServerSentEvents.listen("http://example.com") do |event|
  #       puts event
  #     end
  def self.listen(address, headers = {}, &callback)
    Client.new(URI(address), Parser.new, headers).listen(&callback)
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
server_sent_events-0.1.1 lib/server_sent_events.rb
server_sent_events-0.1.0 lib/server_sent_events.rb