Skip to content

VAPI-3656: re-attach published streams on websocket reconnect - #15

Open
stampercasey wants to merge 1 commit into
mainfrom
VAPI-3656
Open

VAPI-3656: re-attach published streams on websocket reconnect#15
stampercasey wants to merge 1 commit into
mainfrom
VAPI-3656

Conversation

@stampercasey

Copy link
Copy Markdown

Summary

  • On a server-forced websocket close (e.g. a pv-gateway deploy/drain), the SDK auto-reconnects and re-emits init, which rebuilds a fresh, trackless publishing RTCPeerConnection every time.
  • Nothing replayed the already-published local MediaStreams onto the new peer connection, so the mic never got re-attached - the endpoint silently dropped outgoing audio and got stuck permanently ineligible for new calls on the gateway side.
  • init() now checks publishedStreams: if non-empty, it re-attaches each stream via addStreamToPublishingPeerConnection and renegotiates with offerPublishSdp. No-op on a first connect since publishedStreams is empty then.

Test plan

  • npm test - full suite passes (73/73), including two new cases covering first-connect (no-op) and reconnect (replay) behavior
  • npm run build - clean

Jira: VAPI-3656

…tion on reconnect

The websocket auto-reconnects and re-emits "init", which rebuilds a fresh,
trackless publishing peer connection every time. Nothing replayed the
already-published local streams onto it, so a server-forced reconnect
(e.g. during a gateway deploy) silently dropped outgoing audio and left
the endpoint stuck ineligible for new calls.
@stampercasey
stampercasey requested review from a team as code owners August 6, 2026 14:39
@bwappsec

bwappsec commented Aug 6, 2026

Copy link
Copy Markdown

Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues
Licenses 0 0 0 0 0 issues
Code Security 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

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.

2 participants