Backport support for WebSocket heartbeat

See 4709587