lib/sinatra/websocketio/client.rb in sinatra-websocketio-0.2.8 vs lib/sinatra/websocketio/client.rb in sinatra-websocketio-0.2.9
- old
+ new
@@ -24,9 +24,18 @@
on :__session_id do |session_id|
@session = session_id
emit :connect, @session
end
+
+ on :connect do
+ @thread_heartbeat = Thread.new do
+ while @connecting
+ push :__heartbeat, {:time => Time.now.to_i}
+ sleep 10
+ end
+ end
+ end
end
def connect
return self if connecting
this = self