-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Added query per subscription and queryKeys along with the messages #11202
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
b785dea
added query per subscription and queryKeys along with the messages
ArnabChatterjee20k cbe13d7
removed redundant key
ArnabChatterjee20k 72db0c7
Merge branch '1.8.x' into realtime-query-subscriptions
ArnabChatterjee20k 64392c1
fixed failing tests
ArnabChatterjee20k 077068e
updated tests
ArnabChatterjee20k 6e576b5
added realtime query new channel and channel wise filters
ArnabChatterjee20k 3c2f0cc
updated to new slot based filtering for realtime
ArnabChatterjee20k 10e971a
updated tests and empty subscriptionsid issue
ArnabChatterjee20k 29b6adf
Merge branch '1.8.x' into realtime-query-subscriptions
ArnabChatterjee20k d18d4d8
updated subscription process
ArnabChatterjee20k a10fbc6
updated subscription after permission change
ArnabChatterjee20k 4319612
updated unit tests
ArnabChatterjee20k 0528c0d
updated the case for select all and empty payload
ArnabChatterjee20k File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Include queryKeys in event payloads.
getSubscribers()returns matched query keys per subscription, but the payload only includes subscription IDs. Without queryKeys, SDKs can’t filter per subscription when multiple queries share a connection, which conflicts with the PR objective.💡 Suggested fix
$data = $event['data']; // Send matched subscription IDs $data['subscriptions'] = array_keys($matchedSubscriptions); + // Send matched query keys per subscription + $data['queryKeys'] = $matchedSubscriptions;🤖 Prompt for AI Agents
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
but isn't this expected and handled via slot based subscription id builder?
if two channels are having exactly having queries then they will receive the same payload and should have the same id
if you check
public static function constructSubscriptions(array $channelNames, callable $getQueryParam): array
and read this
/**
* Constructs subscriptions from query parameters.
*
* Reconstructs subscription structure from query params where subscription indices can span multiple channels.
* Format: {channel}[subscriptionIndex][]=query1&{channel}[subscriptionIndex][]=query2
*
* Example:
* - tests[0][]=select(*) → subscription 0: channels=["tests"]
* - tests[1][]=equal(...) & prod[1][]=equal(...) → subscription 1: channels=["tests", "prod"]
*
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🏁 Script executed:
Length of output: 0
🏁 Script executed:
Length of output: 4564
@ArnabChatterjee20kYou're absolutely right, and I apologize for the confusion. I misunderstood the slot-based subscription architecture.After reviewing
constructSubscriptions(), the flow is clear:tests[0][]=select(*),tests[1][]=equal(...)ID::unique(), returned assubscriptions: {0: "sub_abc", 1: "sub_def"}subscriptionId → callback(e.g.,{"sub_abc": callback1, "sub_def": callback2})subscriptions: ["sub_abc"], the SDK looks up and invokes the correct callbackThe subscription IDs already uniquely identify which channel+query combination matched, so queryKeys are indeed redundant. The SDK can route messages to the correct callbacks using subscription IDs alone.
My original suggestion was incorrect. The current implementation properly supports multiple subscriptions per connection by using subscription IDs as the routing key. Thank you for the clarification! 🙏
🧬 Code Graph Analysis Results