[Fix] 020-twilio-media-streams-node — update to SDK v5 createConnection/waitForOpen API#84
Merged
lukeocodes merged 2 commits intomainfrom Mar 30, 2026
Conversation
…et API Use createConnection/connect/waitForOpen pattern instead of deprecated connect-then-reconnect flow. Replace sendCloseStream with sendFinalize. Remove redundant JSON.parse in message handler (SDK provides parsed data). 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
Contributor
Author
Code ReviewOverall: APPROVED Integration genuinenessPass — Twilio SDK ( Code quality
Documentation
Tests
✓ All checks pass. Marking review passed. Review by Lead on 2026-03-30 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix: 020-twilio-media-streams-node regression
Root cause: The example used the old
listen.v1.connect()pattern which immediately opens a WebSocket, then calleddgConnection.connect()again causing a reconnection cycle. It also used the deprecatedsendCloseStream()method and manually parsed JSON from themessageevent (which the SDK v5 already provides as parsed objects).Changes
createConnection()+connect()+waitForOpen()pattern per SDK v5 docssendCloseStream({ type: 'CloseStream' })withsendFinalize({ type: 'Finalize' })messageeventsTest plan
Fixed by engineer on 2026-03-30