fix NIP-01 top-level JSON array messages.

This commit is contained in:
fiatjaf 2021-10-04 01:28:16 -03:00
parent 9ee3a0259e
commit 69509f40cd
1 changed files with 6 additions and 5 deletions

View File

@ -44,12 +44,13 @@ To obtain the `event.id`, we `sha256` the serialized event. The serialization is
### Communication between clients and relays
Relays expose a websocket endpoint at its domain under the `/ws` path (say, `ws(s)://relay.domain/ws`) to which clients can connect.
Relays expose a websocket endpoint to which clients can connect.
Clients can send either 3 types of messages, according to the following patterns:
* `EVENT <event JSON as defined above>`, used to publish events.
* `REQ <id> <filter JSON>...`, used to request events and subscribe to new updates.
* `CLOSE <id>`, used to stop previous subscriptions.
Clients can send either 3 types of messages, which must be JSON arrays, according to the following patterns:
* `["EVENT", <event JSON as defined above>`], used to publish events.
* `["REQ", <id>, <filter JSON>...`], used to request events and subscribe to new updates.
* `["CLOSE", <id>]`, used to stop previous subscriptions.
`<id>` is a random string that should be used to represent a subscription. The same