Skip to content
This repository was archived by the owner on Apr 13, 2022. It is now read-only.

Commit 3c59b84

Browse files
mention read caps in Updates-Via
1 parent aefe0c3 commit 3c59b84

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

api-websockets.md

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,17 +31,18 @@ RESPONSE:
3131
```http
3232
HTTP/1.1 200 OK
3333
...
34-
Updates-Via: wss://example.org/
34+
Updates-Via: wss://example.org/?access_token=Ne3jiZ1Mei6Air6iefoh
3535
```
3636

37+
The URL mentioned in the `Updates-Via` header should act as a [capability](https://en.wikipedia.org/wiki/Capability-based_security).
3738
To subscribe to a resource, clients will need to send the keyword `sub` followed
3839
by an empty space and then the URI of the resource:
3940

4041
```
4142
sub https://example.org/data/test
4243
```
4344

44-
If a change occurs and the client is subscribed to that resource, it will
45+
If a change occurs and the client is subscribed to that resource and has Read access to it, it will
4546
receive a WebSocket message composed of the keyword `pub`, followed by an empty
4647
space and the URI of the resource that has changed:
4748

@@ -50,9 +51,10 @@ pub https://example.org/data/test
5051
```
5152

5253
Subscribing to a container can also be really useful, since all CRUD operations
53-
(POST, PUT, PATCH, DELETE) performed on resources of that container will trigger
54+
(POST, PUT, PATCH, DELETE) performed on member resources of that container will trigger
5455
a notification for the container URI. This makes synchronization between
55-
multiple apps really easy.
56+
multiple apps really easy. It only affects the parent container, of which the resource is a member,
57+
not further ancestor containers.
5658

5759
For example, a client subscribes to the `data/` container:
5860

@@ -75,6 +77,10 @@ Then the following notification message will be sent:
7577
pub https://example.org/data/
7678
```
7779

80+
The server may send additional informational messages for e.g. error reporting,
81+
as long as they don't start with `pub`.
82+
If a client subscribes to too many updates, the server may close the socket.
83+
7884
Here is a Javascript example on how to subscribe to live updates for a `test`
7985
resource at `https://example.org/data/test`:
8086

0 commit comments

Comments
 (0)