Skip to content

Live queries / real-time queries #1174

@joepio

Description

@joepio

I was migrating ChatRoom to Loro #1173 and was blocked because we can no longer send append commits. We had a custom ChatRoom.rs plugin that created these (server side!) commits to inform the client that a chatroom has a new msg. I never liked this approach, because it only works for chatroom. In tables, we just re-query when things change... In Folder, we have a parent->child relatiosShip (subResource) because we want to show children in the sidebar, and we need this to update in real time.

In short: we have a lot of hacky solutions for something that should have been a more fundamental architectural solution: support live queries.

We already have websockets, we have should_update calls for queries, we have a whole clever atom based indexing pipeline... In other words, most of the foundational work is done.

  • I think we'll need a new /ws message, SubscribeQuery, so the server can store a map of clietns and the queries they want to follow
  • The results of a query should be a loro List so the server can efficiently add things in the right place.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions