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

[PUB-773] LiveObjects product docs #2463

Open
wants to merge 9 commits into
base: integration/liveobjects
Choose a base branch
from

Conversation

VeskeR
Copy link
Contributor

@VeskeR VeskeR commented Mar 5, 2025

Description

Adds LiveObjects product documentation to content section. Final docs structure can be found here: https://ably.atlassian.net/wiki/spaces/LOB/pages/3839623174/LORFC-001+LiveObjects+Product+Docs+structure.

This PR adds documentation for next LiveObjects pages:

  • About LiveObjects
  • Quickstart
  • Setup
  • LiveCounter
  • LiveMap
  • Batching Operations
  • Objects Lifecycle Events
  • Typing LiveObjects

Resolves PUB-773

Site navigation for LiveObjects is added in #2464, but can be moved into this PR if requested.

Checklist

@VeskeR VeskeR requested review from mschristensen and a team March 5, 2025 09:15
Copy link

coderabbitai bot commented Mar 5, 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-pub-773-liveo-07sgjc March 5, 2025 09:15 Inactive
@VeskeR VeskeR force-pushed the PUB-773/liveobjects-product-docs branch from 3bfe8d2 to 145457e Compare March 5, 2025 09:31
@m-hulbert m-hulbert temporarily deployed to ably-docs-pub-773-liveo-07sgjc March 5, 2025 10:06 Inactive
@VeskeR VeskeR requested a review from a team March 5, 2025 20:26
@VeskeR VeskeR force-pushed the PUB-773/liveobjects-product-docs branch 3 times, most recently from 1f7289e to 2f870cd Compare March 7, 2025 09:18
@VeskeR VeskeR marked this pull request as ready for review March 7, 2025 09:19
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 stuff, thanks for this! A few comments

@VeskeR VeskeR force-pushed the PUB-773/liveobjects-product-docs branch 2 times, most recently from 7c9bad3 to 25b2298 Compare March 11, 2025 08:24
@VeskeR VeskeR mentioned this pull request Mar 11, 2025
3 tasks
@VeskeR VeskeR requested a review from mschristensen March 11, 2025 08:34
@m-hulbert m-hulbert temporarily deployed to ably-docs-pub-773-liveo-snhs8k March 12, 2025 08:56 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 stuff, thanks Andrii. Final review from me and then this looks good - apologies for the high volume of nit picky comments, but I've attempted to suggest changes to ensure we have a consistent use of terminology:

  • "LiveObjects" is used to refer to the product name, rather than object instance (and is never "Live Objects")
  • objects is used to refer to object instances
  • avoid use of state and prefer channel objects

Hopefully in suggestion format these changes are relatively easy to apply. Thanks again for this :)


To batch operations together, use the @channel.objects.batch()@ method. This method accepts a callback function, which is provided with a batch context object. The batch context object provides a synchronous API to work with LiveObjects on a channel that stores operations inside the batch instead of applying them immediately.

Using the batch context ensures that operations are grouped and sent after the batch callback function has run, which means that all clients receive them as a single message.
Copy link
Member

Choose a reason for hiding this comment

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

Maybe the emphasis here should be that they are applied atomically (both by the server and any clients), rather than just being received simultaneously

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@paddybyers
Copy link
Member

paddybyers commented Mar 13, 2025

I've not seen anything explaining how this works offline. I think somewhere we should explain the model in that LiveObjects is an online-oriented feature; object creation and mutation operations initiated by a client are processed by the backend at the time. In this iteration at least, there's no offline mode, or synchronisation of changes made locally by a client while disconnected.

@m-hulbert m-hulbert temporarily deployed to ably-docs-pub-773-liveo-olyhs1 March 17, 2025 11:10 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.

This is really great, Andrii.

I've made a few suggestions for fixes and enhancements. I've commented in a few places, but you don't need to include blang[] as that just hides/shows content only relevant to 1 language (see here for info).

I also wonder if we can include something a diagram, or something visual to help explain LiveObjects on the 'about' page.

Comment on lines +34 to +38
* "Composability":#composability
* "Batching operations":#batch
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we consider batching and composability as features on par with LiveMap and LiveCounter, or are they more key functionality that the features implement?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

batching

Batching probably deserves to be a separate feature, similarly like we have for message batching on channels.

Also I guess batching can be considered as a feature of the state synchronization engine - to enable applying operations to state atomically.

On the other hand, if we really want to make it a "functionallity of the feature", then I'm not sure where to add it. Batching is available on the top level channel.objects instance. Do we consider the Objects instance "a feature" that has batching functionallity? And following this thought, should we then add an Objects header to navigation to describe the API available on the Objects instance at channel.objects?

composability

This one is probably not a "feature", agree. Should probably just remove it from this list and unite the section with LiveMap


On a similar not, regarding Typing in the navigation:
It's not necessarily a "feature" by itself, but a pretty vital part of LiveObjects, we want developers to know that then can type their liveobjects and enjoy TypeScript with this product. Having it as a separate header in the navigation makes it more visible than hiding it under other features like Objects.

Copy link
Contributor

Choose a reason for hiding this comment

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

Batching provides a dedicated API in its own right, so I think it's sensible to include that with its own heading


The Batching API in LiveObjects allows multiple updates to be grouped into a single channel message and applied atomically. It ensures that all operations in a batch either succeed together or are discarded entirely. Batching operations is essential when multiple related updates to the state must be applied as a single atomic unit, for example, when application logic depends on multiple LiveObjects being updated simultaneously. Without batching, if one operation succeeds while another fails, your application state could become inconsistent.

Note that this differs from "Message batching":/docs/messages/batch, the native Pub/Sub messages feature. LiveObjects provides a separate API specifically for grouping LiveObjects operations into a single channel message, allowing the Ably system to guarantee the atomicity of the applied changes.
Copy link
Contributor

Choose a reason for hiding this comment

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

Agree with Paddy here: I made that page to cover the different types of batching in Pub/Sub because the term was becoming very overloaded.

@VeskeR VeskeR force-pushed the PUB-773/liveobjects-product-docs branch 2 times, most recently from 70e3d74 to 0d1c04b Compare March 18, 2025 09:40
@VeskeR
Copy link
Contributor Author

VeskeR commented Mar 18, 2025

@mschristensen

I've attempted to suggest changes to ensure we have a consistent use of terminology

"LiveObjects" is used to refer to the product name, rather than object instance (and is never "Live Objects")

objects is used to refer to object instances

avoid use of state and prefer channel objects

This is actually great! I was struggling a bit with the correct way to address different concepts (for example, 'state on a channel') after the renaming change we made, so this really helps set things in stone.

I'll also add that terminology to the naming PR for future reference when I have a bit more time more time.


I've applied your suggestions and did another pass to remove additional instances of "Live Object" and "state" terminology where necessary.

@VeskeR VeskeR requested a review from mschristensen March 18, 2025 09:47
@VeskeR
Copy link
Contributor Author

VeskeR commented Mar 18, 2025

@m-hulbert

you don't need to include blang[]

This was intentional, see my comment #2463 (comment)

I also wonder if we can include something a diagram, or something visual to help explain LiveObjects on the 'about' page.

The simplest thing would be to do some kind of the object tree diagram, but that alone doesn’t effectively convey the "realtime state synchronization" aspect of LiveObjects.

Rather than a purely technical diagram, a more marketing-oriented illustration - similar to the one we have for LiveSync - might be a better fit here.
image

Since LiveObjects is quite similar in nature, we can use the similar concept: Objects on the channel on the left, the Ably realtime system in the center, and two clients with some JSON data on the right being synced.
@mschristensen WDYT?

@VeskeR VeskeR requested a review from m-hulbert March 18, 2025 11:20
@mschristensen
Copy link
Contributor

Since LiveObjects is quite similar in nature, we can use the similar concept: Objects on the channel on the left, the Ably realtime system in the center, and two clients with some JSON data on the right being synced.
@mschristensen WDYT?

It would be good to get a diagram, but we need to get design to make one, so let's not block this on that basis. I've created a ticket: https://ably.atlassian.net/browse/PUB-1533

This looks good to me, @VeskeR can we redeploy the latest version to Heroku so I can take a final look at the result please?

@m-hulbert is it possible to feature flag these docs so we can merge this but they don't appear on the website until we're ready? There are other docs changes that are coming re. the REST API, which @zknill is working on, so if we can't feature flag we might need to merge this into an integration branch that other docs PRs can target.

@VeskeR VeskeR force-pushed the PUB-773/liveobjects-product-docs branch 2 times, most recently from 56c767d to 326fde2 Compare March 27, 2025 08:43
VeskeR added a commit to ably/ably-js that referenced this pull request Mar 27, 2025
… feature

This commit does next changes:
- removes `state` mentions in comments / internal API. Uses `objects`
  instead where possible
- normalizes terminology used when referencing "LiveObjects" product and
  objects on a channel according to LiveObjects product docs PR [1]
- `STATE` message action -> `OBJECT`
- `STATE_SYNC` message action -> `OBJECT_SYNC`
- `HAS_STATE` flag -> `HAS_OBJECT`
- `StateMessage` type -> `ObjectMessage`
- `StateOperation` type -> `ObjectOperation`
- `StateObject` type -> `ObjectState`
- `StateData` type -> `ObjectData`
- `StateValue` type -> `ObjectValue`

This brings ably-js LiveObjects implementation in line with the naming
changes introduced in the spec PR [2].

[1] ably/docs#2463 (review)
[2] ably/specification#279 (comment)
@m-hulbert m-hulbert temporarily deployed to ably-docs-pub-773-liveo-76mgiy March 28, 2025 14:40 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.

I still have the open question around channel modes, but happy to merge this to the integration branch and address separately for ease.

Regardless of its outcome, can we add the new modes to channels/options#modes first though please?

@mschristensen
Copy link
Contributor

I still have the open question around channel modes, but happy to merge this to the integration branch and address separately for ease.

Regardless of its outcome, can we add the new modes to channels/options#modes first though please?

I have another PR in flight that aligns existing pub/sub docs with any live objects related changes, which will include modes

@mschristensen
Copy link
Contributor

@m-hulbert PR with modes changes here: #2503

VeskeR added a commit to ably/ably-js that referenced this pull request Apr 1, 2025
… feature

This commit does next changes:
- removes `state` mentions in comments / internal API. Uses `objects`
  instead where possible
- normalizes terminology used when referencing "LiveObjects" product and
  objects on a channel according to LiveObjects product docs PR [1]
- `STATE` message action -> `OBJECT`
- `STATE_SYNC` message action -> `OBJECT_SYNC`
- `HAS_STATE` flag -> `HAS_OBJECT`
- `StateMessage` type -> `ObjectMessage`
- `StateOperation` type -> `ObjectOperation`
- `StateObject` type -> `ObjectState`
- `StateData` type -> `ObjectData`
- `StateValue` type -> `ObjectValue`

This brings ably-js LiveObjects implementation in line with the naming
changes introduced in the spec PR [2].

[1] ably/docs#2463 (review)
[2] ably/specification#279 (comment)
@VeskeR VeskeR force-pushed the PUB-773/liveobjects-product-docs branch from 326fde2 to 4d498e1 Compare April 2, 2025 12:46
@VeskeR
Copy link
Contributor Author

VeskeR commented Apr 2, 2025

Removed the capabilities changes from this PR (326fde2) according to the comment. These will be added in #2503

VeskeR added a commit to ably/ably-js that referenced this pull request Apr 9, 2025
… feature

This commit does next changes:
- removes `state` mentions in comments / internal API. Uses `objects`
  instead where possible
- normalizes terminology used when referencing "LiveObjects" product and
  objects on a channel according to LiveObjects product docs PR [1]
- `STATE` message action -> `OBJECT`
- `STATE_SYNC` message action -> `OBJECT_SYNC`
- `HAS_STATE` flag -> `HAS_OBJECT`
- `StateMessage` type -> `ObjectMessage`
- `StateOperation` type -> `ObjectOperation`
- `StateObject` type -> `ObjectState`
- `StateData` type -> `ObjectData`
- `StateValue` type -> `ObjectValue`

This brings ably-js LiveObjects implementation in line with the naming
changes introduced in the spec PR [2].

[1] ably/docs#2463 (review)
[2] ably/specification#279 (comment)
VeskeR added a commit to ably/ably-js that referenced this pull request Apr 9, 2025
… feature

This commit does next changes:
- removes `state` mentions in comments / internal API. Uses `objects`
  instead where possible
- normalizes terminology used when referencing "LiveObjects" product and
  objects on a channel according to LiveObjects product docs PR [1]
- `STATE` message action -> `OBJECT`
- `STATE_SYNC` message action -> `OBJECT_SYNC`
- `HAS_STATE` flag -> `HAS_OBJECT`
- `StateMessage` type -> `ObjectMessage`
- `StateOperation` type -> `ObjectOperation`
- `StateObject` type -> `ObjectState`
- `StateData` type -> `ObjectData`
- `StateValue` type -> `ObjectValue`

This brings ably-js LiveObjects implementation in line with the naming
changes introduced in the spec PR [2].

[1] ably/docs#2463 (review)
[2] ably/specification#279 (comment)
VeskeR added a commit to ably/ably-js that referenced this pull request Apr 9, 2025
… feature

This commit does next changes:
- removes `state` mentions in comments / internal API. Uses `objects`
  instead where possible
- normalizes terminology used when referencing "LiveObjects" product and
  objects on a channel according to LiveObjects product docs PR [1]
- `STATE` message action -> `OBJECT`
- `STATE_SYNC` message action -> `OBJECT_SYNC`
- `HAS_STATE` flag -> `HAS_OBJECT`
- `StateMessage` type -> `ObjectMessage`
- `StateOperation` type -> `ObjectOperation`
- `StateObject` type -> `ObjectState`
- `StateData` type -> `ObjectData`
- `StateValue` type -> `ObjectValue`

This brings ably-js LiveObjects implementation in line with the naming
changes introduced in the spec PR [2].

[1] ably/docs#2463 (review)
[2] ably/specification#279 (comment)
@VeskeR VeskeR force-pushed the PUB-773/liveobjects-product-docs branch from 4d498e1 to 451c972 Compare April 9, 2025 08:13
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.

LGTM - just one small change for sentence case.

@@ -0,0 +1,66 @@
---
title: Lifecycle Events
Copy link
Contributor

Choose a reason for hiding this comment

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

Can this be sentence case please? In the table of contents too (and the same for 'Batch Operations'

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@VeskeR VeskeR force-pushed the PUB-773/liveobjects-product-docs branch from b782e1f to 6532e7f Compare April 11, 2025 09:10
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