Created
March 18, 2016 09:56
-
-
Save kenichi/6fb7989238bcdc3b3402 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'angelo' | |
class BG < Angelo::Base | |
websocket '/' do |ws| | |
websockets << ws | |
end | |
end | |
class Worker | |
include Celluloid | |
def run | |
@n = 1 | |
every 1 do | |
@n += 1 | |
n = @n.to_s | |
BG.websockets.each {|ws| ws.write n} | |
end | |
end | |
end | |
Worker.new.async.run | |
BG.run! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment