Skip to content

Subscriptions with no immediate response #105

Description

@josephg

We had an issue come up today around subscriptions where the server:

  • Doesn't respond with a snapshot and
  • Doesn't name the current version

Eg, the subscription response looks like this:

HTTP/1.1 209 Subscription
content-type: application/json
transfer-encoding: chunked

(And no subsequent data is sent indefinitely.)

The problem is that the client has no idea what to display to the user - they have no idea what the document looks like until the server sends an update. This would result in bad UX (loading spinner forever), and I consider it an antipattern. I think the spec should recommend against this.

I think either:

  • The client doesn't have a copy of the document. In the response the server should immediately either send a snapshot of the document, or send all patches immediately) or
  • The client does have a copy of the document at some known version. The client names that version in its request (using the parents: header) and the server responds by bringing the client up to date, and uses the current-versions: header to name the most recent version.

I propose we add wording like this in the spec:

The server SHOULD either use the current-version header or when a client connects, or immediately send a full snapshot update.

@toomim said there are some other valid use cases for servers doing this. What are the other use cases I'm missing?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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