Sha256: 1a75ad8bf13579fc72fbc8817b926afa06f074a68e5f4c38a791d757cf82580f
Contents?: true
Size: 704 Bytes
Versions: 1
Compression:
Stored size: 704 Bytes
Contents
pid_file = ENV['PID_FILE'] || "/tmp/sinatra-websocketio-test-pid" File.open(pid_file, "w+") do |f| f.write Process.pid.to_s end class TestApp < Sinatra::Application get '/' do "sinatra-websocketio v#{Sinatra::WebSocketIO::VERSION}" end WebSocketIO.on :connect do |session| puts "new client <#{session}>" end WebSocketIO.on :disconnect do |session| puts "disconnect client <#{session}>" end WebSocketIO.on :broadcast do |data, from| puts from puts "broadcast <#{from}> - #{data.to_json}" push :broadcast, data end WebSocketIO.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-websocketio-0.0.6 | test/app/main.rb |