Sha256: 788b4369ad4145e24a3122dddabe25058aea6fbf7c7577c43bfa85b6ea1188f3
Contents?: true
Size: 583 Bytes
Versions: 2
Compression:
Stored size: 583 Bytes
Contents
require 'lib/rack/websocket' class MyApp < Rack::WebSocket::Application def on_open puts "client connected" EM.add_timer(5) do send_data "This message should show-up 5 secs later" end EM.add_timer(15) do send_data "This message should show-up 15 secs later" end end def on_message(msg) puts "message received: " + msg send_data "Hello #{msg}" end def on_close puts "client disconnected" end end # use Rack::CommonLogger map '/' do use MyApp run Rack::File.new(File.expand_path(File.dirname(__FILE__)) + '/html') end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
websocket-rack-0.1.1 | example/example.ru |
websocket-rack-0.1.0 | example/example.ru |