Sha256: b7496b68a8be7b41a1e60ec33518d2f0487121ef817f14b7ef9e123efd6a86a4

Contents?: true

Size: 574 Bytes

Versions: 1

Compression:

Stored size: 574 Bytes

Contents

class TestApp < Sinatra::Base
  register Sinatra::CometIO
  io = Sinatra::CometIO

  get '/' do
    "sinatra-cometio v#{Sinatra::CometIO::VERSION}"
  end

  io.on :connect do |session|
    puts "new client <#{session}>"
  end

  io.on :disconnect do |session|
    puts "disconnect client <#{session}>"
  end

  io.on :broadcast do |data, from|
    puts from
    puts "broadcast <#{from}> - #{data.to_json}"
    push :broadcast, data
  end

  io.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
em-cometio-client-0.1.1 test/app/main.rb