Skip to content

fix(realtime): forward an explicit send() timeout of 0 - #2647

Open
MohammedAlkindi wants to merge 1 commit into
supabase:masterfrom
MohammedAlkindi:fix/realtime-send-timeout-zero
Open

fix(realtime): forward an explicit send() timeout of 0#2647
MohammedAlkindi wants to merge 1 commit into
supabase:masterfrom
MohammedAlkindi:fix/realtime-send-timeout-zero

Conversation

@MohammedAlkindi

Copy link
Copy Markdown

🔍 Description

What changed?

send() resolves an explicit opts.timeout with ?? instead of ||, matching the other two paths in the same method.

Why was this change needed?

send() resolves the timeout in three places. Two use ??:

httpSend()                 opts.timeout ?? this.timeout   // :979
send(), REST fallback      opts.timeout ?? this.timeout   // :1103
send(), websocket branch   opts.timeout || this.timeout   // :1117

0 is falsy, so the websocket branch replaced a caller's timeout: 0 with the channel default while the other two passed it through. The same call therefore behaved differently depending on which branch it took.

git blame shows the || predates the Phoenix adapter refactor and no commit or discussion treats timeout: 0 as deliberately ignored, so this reads as a miss rather than a decision.

🧪 Testing

npx vitest run in packages/core/realtime-js: 474 passed, 2 failed, 1 skipped. Both failures are in RealtimeClient.worker.test.ts and fail identically with opts.timeout || this.timeout restored from master, so they are pre-existing. tsc --noEmit is clean. Reverting the change makes the added test fail on the pushed timeout argument.

📋 Checklist

  • I have read the Contributing Guidelines
  • My PR title follows the conventional commit format
  • I have run Prettier on the changed files
  • I have added tests for new functionality
  • Documentation updated: not applicable

send()'s websocket branch resolved the timeout with ||, so a caller
passing timeout: 0 got the channel default instead. httpSend() and the
REST fallback in the same method already use ??.
@MohammedAlkindi
MohammedAlkindi requested review from a team as code owners September 1, 2026 13:31
@coderabbitai

coderabbitai Bot commented Sep 1, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Team

Run ID: 19f029f8-a19e-48a6-a37c-bc22193f9c51

📥 Commits

Reviewing files that changed from the base of the PR and between b3b939a and fe54fb2.

📒 Files selected for processing (2)
  • packages/core/realtime-js/src/RealtimeChannel.ts
  • packages/core/realtime-js/test/RealtimeChannel.push.test.ts

Included review availability: Your plan provides up to 8 included reviews per hour; 6 remain after this review.


📝 Walkthrough

Summary by CodeRabbit

  • Bug Fixes

    • Fixed channel message sending so an explicitly configured timeout of 0 is preserved instead of being replaced by the default channel timeout.
  • Tests

    • Added coverage to verify that zero-timeout settings are correctly forwarded when sending messages.

Walkthrough

RealtimeChannel.send() now uses nullish-coalescing for timeout selection. An explicit timeout: 0 is preserved instead of being replaced by the channel timeout. A regression test verifies that channelAdapter.push receives 0 for a joined channel.

Merge Risk: ⚪ Minimal · up to fe54f

The WebSocket send path now preserves an explicitly supplied timeout of 0, matching the existing HTTP paths. The change is localized and no actionable merge-blocking risk remains after normal checks and review.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

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