Sha256: 2d06f67384978477a3163508562494fe74a4b92cf5937b0ff42cfd17597c4312

Contents?: true

Size: 922 Bytes

Versions: 14

Compression:

Stored size: 922 Bytes

Contents

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

  get '/' do
    "sinatra-rocketio v#{Sinatra::RocketIO::VERSION}"
  end

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

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

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

  io.on :message do |data, client|
    puts "message <session:#{client.session}> <type:#{client.type}> - #{data.to_json}"
    push :message, data, :to => data['to']
  end

  io.on :to_channel do |data, client|
    puts "message to channel:#{client.channel} <type:#{client.type}> - #{data.to_json}"
    push :to_channel, data, :channel => client.channel
  end

end

Version data entries

14 entries across 14 versions & 2 rubygems

Version Path
sinatra-rocketio-0.3.3 test/app/main.rb
sinatra-rocketio-0.3.2 test/app/main.rb
sinatra-rocketio-0.3.1 test/app/main.rb
sinatra-rocketio-0.3.0 test/app/main.rb
em-rocketio-client-0.1.2 test/app/main.rb
sinatra-rocketio-0.2.6 test/app/main.rb
sinatra-rocketio-0.2.5 test/app/main.rb
sinatra-rocketio-0.2.4 test/app/main.rb
sinatra-rocketio-0.2.3 test/app/main.rb
sinatra-rocketio-0.2.2 test/app/main.rb
em-rocketio-client-0.1.1 test/app/main.rb
sinatra-rocketio-0.2.1 test/app/main.rb
em-rocketio-client-0.1.0 test/app/main.rb
sinatra-rocketio-0.2.0 test/app/main.rb