Add extras in the message for channel push notifications#134
Add extras in the message for channel push notifications#134
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
WalkthroughThe changes add support for including extras.push in the Ably channel publish command payload. Documentation is updated to reflect this capability, implementation extracts extras from messageData and assigns them to the message's extras field, and tests verify the extras.push content passes through correctly to the channel publish call. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
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. Comment |
| '$ ably channels publish --transport realtime my-channel "Using realtime transport"', | ||
| '$ ably channels publish my-channel "Hello World" --json', | ||
| '$ ably channels publish my-channel "Hello World" --pretty-json', | ||
| '$ ably channels publish my-channel \'{"data":"Push notification","extras":{"push":{"notification":{"title":"Hello","body":"World"}}}}\'', |
There was a problem hiding this comment.
Should add this as an --extras flag to the command? Right now what comes after my-channel is assumed to be the entire data field so implicitly taking something out of it might be confusing?
There was a problem hiding this comment.
I thought that when you type it like publish my-channel "Hello World" - it's a data for the message, but if you specify the whole message like this publish my-channel \'{"data":"Push notification","extras":{"push..., then whatever can be inside the message.
There was a problem hiding this comment.
Oops yes I misread that, that now makes sense!
There was a problem hiding this comment.
@AndyTWF should we go with this or changes still needed?
6a7494b to
207544c
Compare
It is not support of push notifications with deviceId or clientId. Just have added
extras.pushsupport for channel pushes. Tried locally with./bin/run.js channels publish exampleChannel1 '{"data":"Test","extras":{"push":{"notification":{"title":"Hello","body":"World!"}}}}' --api-key "***"and it works.
Note
Low Risk
Small, additive change to message construction plus a unit test and docs update; minimal impact outside publish payload shape.
Overview
ably channels publishnow extracts anextrasobject from JSON message input and sends it asmessage.extras(removing it from thedatapayload to avoid duplication), enablingextras.pushpush-notification metadata to be included with published messages.Documentation and examples were updated to mention
extras.push, and a unit test was added to assertextras.pushis forwarded correctly in the publish call.Written by Cursor Bugbot for commit 207544c. This will update automatically on new commits. Configure here.
Summary by CodeRabbit
New Features
Documentation
Tests