Skip to content
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

add batch push publish docs #2480

Merged
merged 1 commit into from
Apr 8, 2025
Merged

add batch push publish docs #2480

merged 1 commit into from
Apr 8, 2025

Conversation

owenpearson
Copy link
Member

@owenpearson owenpearson commented Mar 13, 2025

adds REST API reference and conceptual docs for batch push

see implementation here: https://github.com/ably/realtime/pull/7217

PUB-1319

Copy link

coderabbitai bot commented Mar 13, 2025

Important

Review skipped

Auto reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.


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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai plan to trigger planning for file edits and PR creation.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@ably-ci ably-ci temporarily deployed to ably-docs-batch-push-eajw0gpys March 13, 2025 16:24 Inactive
@m-hulbert m-hulbert temporarily deployed to ably-docs-batch-push-qfok2100v March 20, 2025 17:00 Inactive
Copy link
Contributor

@mschristensen mschristensen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great thanks for this, a few comments. I think we also need to include something about:

@owenpearson owenpearson force-pushed the batch-push branch 2 times, most recently from 10782fa to 99e185a Compare April 8, 2025 10:08
@owenpearson
Copy link
Member Author

@mschristensen have resolved all the suggestions. regarding your review comment:

What the response looks like, especially for partially failed requests, similar to https://ably-docs-batch-push-qfok2100v.herokuapp.com/docs/api/rest-api?lang=javascript#batch-publish

the endpoint responds with 201 on success, and a generic error info upon failure. There's actually no client visible partial failure case here because the entire batch is added to the queue - the rest api doesn't discriminate between items within the batch. It's either bad request, server error, or 201 no content.

Supported parameters or options as in https://ably-docs-batch-push-qfok2100v.herokuapp.com/docs/api/rest-api?lang=javascript#push-publish

There aren't any public params or options here so nothing to add.

What the limit is per request

I've added something to both pages about a 10k limit. The idea was to discern the limit from load testing, hence why i've been holding off from updating this, but it's likely to be 10k in the end so will leave it as that.

@m-hulbert m-hulbert temporarily deployed to ably-docs-batch-push-v5qhnaldl April 8, 2025 10:39 Inactive
Copy link
Contributor

@m-hulbert m-hulbert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couple of minor suggestions. Can we also add an item to the main 'publish directly' section bullet points to include batch too?

@@ -778,6 +778,66 @@ var notification = new
rest.Push.Admin.Publish(recipient, notification);
```

h3(#via-batch-push-api). Publish via batch push API

The batch push API allows you to publish push notifications to multiple devices or browsers in a single request. This is useful when you need to send a large number of distinct push notifications to multiple recipients. If you are publishing the same notification to multiple recipients, prefer publishing "via channels":#via-channels.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
The batch push API allows you to publish push notifications to multiple devices or browsers in a single request. This is useful when you need to send a large number of distinct push notifications to multiple recipients. If you are publishing the same notification to multiple recipients, prefer publishing "via channels":#via-channels.
The batch push API enables you to publish push notifications to multiple devices or browsers in a single request.
This is useful when you need to send a large number of distinct push notifications to multiple recipients. If you are publishing the same notification to multiple recipients, publish "via channels":#via-channels instead.

h3(#via-batch-push-api). Publish via batch push API

The batch push API allows you to publish push notifications to multiple devices or browsers in a single request. This is useful when you need to send a large number of distinct push notifications to multiple recipients. If you are publishing the same notification to multiple recipients, prefer publishing "via channels":#via-channels.
The batch push endpoint accepts a JSON array of @PushPublishSpec@ objects, each of which contains a @recipient@ or array of recipients, and a @payload@, where @payload@ is the same as the payload you would use in a normal direct publish request.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
The batch push endpoint accepts a JSON array of @PushPublishSpec@ objects, each of which contains a @recipient@ or array of recipients, and a @payload@, where @payload@ is the same as the payload you would use in a normal direct publish request.
The batch push endpoint accepts a JSON array of @PushPublishSpec@ objects, each of which contain a @recipient@ or array of recipients, and a @payload@, where @payload@ is the same as the payload you would use in a normal direct publish request.

The batch push endpoint accepts a JSON array of @PushPublishSpec@ objects, each of which contains a @recipient@ or array of recipients, and a @payload@, where @payload@ is the same as the payload you would use in a normal direct publish request.
Currently the batch push endpoint allows a maximum of 10,000 recipients per request (recipients are counted per payload, so publishing two payloads to the same recipient counts as two recipients).

The following example shows how to publish multiple push notifications in one request using the batch API with the generic REST SDK @request@ method:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
The following example shows how to publish multiple push notifications in one request using the batch API with the generic REST SDK @request@ method:
The following example shows how to publish multiple push notifications in one request using the batch API with the generic REST "@request()@":/docs/api/rest-sdk#request method:

Copy link
Member

@paddybyers paddybyers left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks

@m-hulbert m-hulbert temporarily deployed to ably-docs-batch-push-v5qhnaldl April 8, 2025 13:48 Inactive
@owenpearson owenpearson removed the request for review from mschristensen April 8, 2025 13:50
@owenpearson owenpearson dismissed mschristensen’s stale review April 8, 2025 13:52

already approved by engineering and need to deploy asap for customer

Copy link
Contributor

@mschristensen mschristensen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, a minor suggestion

h3(#push-publish-batch). Publish via batch push API

Convenience endpoint to deliver multiple push notification payloads to multiple devices or browsers in a single request by specifying a list of recipients and corresponding payloads.
Currently the batch push endpoint allows a maximum of 10,000 recipients per request (recipients are counted per payload, so publishing two payloads to the same recipient counts as two recipients).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we change this wording from "recipients" to "notifications" as the thing which is limited?
E.g.: "Currently the batch push endpoint allows a maximum of 10,000 notifications per request (one notification is counted as one payload delivered to one recipient, so publishing two payloads to the same recipient counts as two notifications)."

@owenpearson owenpearson force-pushed the batch-push branch 3 times, most recently from a74497a to 4fc07b1 Compare April 8, 2025 14:45
@owenpearson owenpearson merged commit e41e03d into main Apr 8, 2025
5 checks passed
@owenpearson owenpearson deleted the batch-push branch April 8, 2025 15:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

5 participants