lib/angelo.rb in angelo-0.1.14 vs lib/angelo.rb in angelo-0.1.15

- old
+ new

@@ -23,10 +23,11 @@ CONTENT_LENGTH_HEADER_KEY = 'Content-Length' ATTACHMENT_CONTENT_DISPOSITION = 'attachment; filename="%s"' ETAG_HEADER_KEY = 'ETag' IF_NONE_MATCH_HEADER_KEY = 'If-None-Match' LOCATION_HEADER_KEY = 'Location' + SSE_HEADER = { CONTENT_TYPE_HEADER_KEY => 'text/event-stream' } HTML_TYPE = 'text/html' JSON_TYPE = 'application/json' FORM_TYPE = 'application/x-www-form-urlencoded' FILE_TYPE = 'application/octet-stream' @@ -55,10 +56,13 @@ DASH = '-' EMPTY_STRING = '' HALT_STRUCT = Struct.new :status, :body + SSE_DATA_TEMPLATE = "data: %s\n\n" + SSE_EVENT_TEMPLATE = "event: %s\ndata: %s\n\n" + class << self attr_writer :response_log_level def response_log_level @@ -120,9 +124,10 @@ require 'angelo/params_parser' require 'angelo/server' require 'angelo/base' require 'angelo/stash' require 'angelo/responder' +require 'angelo/responder/eventsource' require 'angelo/responder/websocket' # trap "INT" do # result = RubyProf.stop # printer = RubyProf::MultiPrinter.new(result)