From e3bf82625e1572e54dee0f3225512de61f5f2d08 Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Tue, 7 Jul 2015 22:33:48 +0200 Subject: [PATCH] Document heartbeat purpose --- lib/action_cable/connection/heartbeat.rb | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/action_cable/connection/heartbeat.rb b/lib/action_cable/connection/heartbeat.rb index 47cd937c25..e0f4a97f53 100644 --- a/lib/action_cable/connection/heartbeat.rb +++ b/lib/action_cable/connection/heartbeat.rb @@ -1,5 +1,8 @@ module ActionCable module Connection + # Websocket connection implementations differ on when they'll mark a connection as stale. We basically never want a connection to go stale, as you + # then can't rely on being able to receive and send to it. So there's a 3 second heartbeat running on all connections. If the beat fails, we automatically + # disconnect. class Heartbeat BEAT_INTERVAL = 3