method

setup_heartbeat_timer

rails latest stable - Class: ActionCable::Server::Connections
setup_heartbeat_timer()
public

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 communicate with the connection. To solve this, a 3 second heartbeat runs on all connections. If the beat fails, we automatically disconnect.