Skip to content

fix(streaming): reply to server ping keepalives with pong to prevent 30s stream disconnect - #1834

Open
manzerw wants to merge 2 commits into
dgreif:mainfrom
manzerw:fix-rms-ping-keepalive-dgreif
Open

manzerw wants to merge 2 commits into
dgreif:mainfrom
manzerw:fix-rms-ping-keepalive-dgreif

Conversation

@manzerw

@manzerw manzerw commented Sep 11, 2026

Copy link
Copy Markdown

Problem

Live WebRTC streams terminate after ~30 seconds with Ring closing the session:
reason: { code: 6, text: 'Timeout waiting for ping' } (or answered_timeout).

Root Cause

While WebrtcConnection periodically transmits ping requests to the Ring RMS server, the server also sends {"method":"ping"} keepalives to the client.

In handleMessage(), incoming server ping messages are not recognized, falling through the switch statement to logError('UNKNOWN MESSAGE') without dispatching an acknowledgement. When Ring's media gateway does not receive a pong reply within its timeout window, it terminates the stream.

Solution

  • Added PingMessage interface and included it in IncomingMessage.
  • Handled case 'ping': in handleMessage() to immediately acknowledge with this.sendSessionMessage('pong').

@changeset-bot

changeset-bot Bot commented Sep 11, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 07d2130

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
ring-client-api Patch
homebridge-ring Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant