lib/pubsubstub/stream_action.rb in pubsubstub-0.0.7 vs lib/pubsubstub/stream_action.rb in pubsubstub-0.0.9

- old
+ new

@@ -29,12 +29,13 @@ end private def start_heartbeat @heartbeat = Thread.new do - while true - sleep 15 - @connections.each { |connection| connection << "\n" } + loop do + sleep Pubsubstub.heartbeat_frequency + event = Event.new('ping', name: 'heartbeat').to_message + @connections.each { |connection| connection << event } end end end end end