Skip to content
This repository has been archived by the owner on Dec 7, 2018. It is now read-only.

Commit

Permalink
Improve the SSE example
Browse files Browse the repository at this point in the history
  • Loading branch information
halorgium committed Apr 17, 2013
1 parent ef759db commit 1330e7d
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions examples/server-sent-events.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,15 @@ def initialize(host, port)
[200, {'Content-Type' => 'text/event-stream'}, body]
end

get '/wall/:rest' do |request|
deliver request.path.rest
end

get '/wall' do
msg = "" # env['PATH_INFO'].gsub(/\/+/, '').strip
msg = Time.now.to_s if msg.empty?
deliver Time.now.to_s
end

def deliver(msg)
Celluloid.logger.info "sending a message to clients: #{msg.inspect}"
@connections.each do |s|
begin
Expand Down

0 comments on commit 1330e7d

Please sign in to comment.