lib/sinatra-websocketio/websocketio.rb in sinatra-websocketio-0.1.2 vs lib/sinatra-websocketio/websocketio.rb in sinatra-websocketio-0.1.3
- old
+ new
@@ -1,8 +1,16 @@
module Sinatra
module WebSocketIO
+ @@running = false
+ def self.running?
+ @@running
+ end
+
+
def self.start
+ return if running?
+ @@running = true
EM::defer do
while !EM::reactor_running? do
sleep 1
end
puts "Sinatra::WebSocketIO.start port:#{options[:port]}"