Sha256: c27de60c343afe7bd11e2b2fbe076e99c280a5d2e3616759e7187651f73959a1
Contents?: true
Size: 606 Bytes
Versions: 1
Compression:
Stored size: 606 Bytes
Contents
class TestApp < Sinatra::Base register Sinatra::CometIO get '/' do "sinatra-cometio v#{Sinatra::CometIO::VERSION}" end Sinatra::CometIO.on :connect do |session| puts "new client <#{session}>" end Sinatra::CometIO.on :disconnect do |session| puts "disconnect client <#{session}>" end Sinatra::CometIO.on :broadcast do |data, from| puts from puts "broadcast <#{from}> - #{data.to_json}" push :broadcast, data end Sinatra::CometIO.on :message do |data, from| puts "message <#{from}> - #{data.to_json}" push :message, data, :to => data['to'] end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
sinatra-cometio-0.6.0 | test/app/main.rb |