Skip to the content.

SUBSCRIBE

← Back to Home - To Transport


The SUBSCRIBE packet is used to subscribe the user to updates from a bucket or from a range of slots in a bucket. It returns the data asynchronous and potentially partial, so after the SUBSCRIBE response other responses can be expected in the future. These are REQUEST responses.

Request

Subscribe request bytemap

Figure A: SUBSCRIBE request byte-map (header and body)


The SUBSCRIBE request (see Figure A) includes a header. This header contains one field: the bucket id which indicates the bucket to subscribe to.

The SUBSCRIBE packet accepts no extra flags.

The body can contain the following fields:

If both indexes are omitted, the user will be subscribed to all slots/to the entire bucket.

Response

Subscribe response bytemap

Figure B: SUBSCRIBE response byte-map


The SUBSCRIBE request does not return any data directly. However, when an update occurs, a REQUEST response is sent to the user.

You might encounter the following error codes:

Process and flow

Subscribe process

Figure C: SUBSCRIBE process flow


The SUBSCRIBE process (see Figure C) goes as follows:

  1. The client sends a SUBSCRIBE packet to the server
  2. The server checks if the user has read permissions. If not, error code 3 is sent.
  3. If a range is provided, the user is subscribed to only that slot range
  4. If no range is provided, the user is subscribed to the entire bucket (all slots)
  5. When an update is pushed to the bucket (a slot is added or modified, or wiped) a REQUEST is sent with the update data. This response is sent after the response of step 5.

← Back to Home - To Transport - Prev: REQUEST packet - Next: UNSUBSCRIBE packet