mirror of
https://github.com/nostr-protocol/nips.git
synced 2024-12-25 17:55:51 -05:00
opening some space.
This commit is contained in:
parent
3fa03a1aea
commit
8dfb59c70a
30
01.md
30
01.md
|
@ -49,13 +49,13 @@ To obtain the hash `.id`, we `sha256` the UTF-8 byte array of a JSON-serialized
|
||||||
The JSON serialization MUST follow this rules:
|
The JSON serialization MUST follow this rules:
|
||||||
- Minified: No whitespace, line breaks, or other unnecessary formatting used
|
- Minified: No whitespace, line breaks, or other unnecessary formatting used
|
||||||
- Escape Set: ONLY the following characters MUST be escaped:
|
- Escape Set: ONLY the following characters MUST be escaped:
|
||||||
- line break: `0x0A` -> `\n`
|
- line break: `0x0A` to `\n`
|
||||||
- double quote: `0x22` -> `\"`
|
- double quote: `0x22` to `\"`
|
||||||
- backslash: `0x5C` -> `\\`
|
- backslash: `0x5C` to `\\`
|
||||||
- carriage return: `0x0D` -> `\r`
|
- carriage return: `0x0D` to `\r`
|
||||||
- tab character: `0x09` -> `\t`
|
- tab character: `0x09` to `\t`
|
||||||
- backspace: `0x08` -> `\b`
|
- backspace: `0x08` to `\b`
|
||||||
- form feed: `0x0C` -> `\f`
|
- form feed: `0x0C` to `\f`
|
||||||
|
|
||||||
## Verifying
|
## Verifying
|
||||||
|
|
||||||
|
@ -102,13 +102,23 @@ This NIP defines the format of 3 standard tags: `e`, `p`, and `a`. `e`, `p` can
|
||||||
|
|
||||||
# Relay Protocol
|
# Relay Protocol
|
||||||
|
|
||||||
Nostr has two main components: Clients & Relays. Users run a client to fetch/subscribe to events from one or more Relays via WebSockets. Relays are not expected to communicate with one another. It's the Client's responsibility to discover which relay has the event set their user wants to see. Both sides SHOULD verify the hash and the signature of each event upon receipt.
|
Nostr has two main components: Clients & Relays.
|
||||||
|
|
||||||
Clients SHOULD open a single WebSocket connection to each relay and use it for all their subscriptions. Relays MAY limit the number of connections from specific IP/client/etc. All messages are defined as JSON arrays.
|
Users run a client to fetch/subscribe to events from one or more Relays via WebSockets.
|
||||||
|
|
||||||
|
Relays are not expected to communicate with one another. It's the Client's responsibility to discover which relay has the event set their user wants to see.
|
||||||
|
|
||||||
|
Both sides SHOULD verify the hash and the signature of each event upon receipt.
|
||||||
|
|
||||||
|
Clients SHOULD open a single WebSocket connection to each relay and use it for all their subscriptions. Relays MAY limit the number of connections from specific IP/client/etc.
|
||||||
|
|
||||||
|
All messages are defined as JSON arrays.
|
||||||
|
|
||||||
## Subscriptions
|
## Subscriptions
|
||||||
|
|
||||||
Clients send a **subscription** message with one or more filters. The Relay MUST query its database, return all events that match the filter, and keep applying the filter to all connections, returning new events as they arrive. Subscriptions stay indefinitely open until either side closes the subscription or the connection.
|
Clients send a **subscription** message with one or more filters. The Relay MUST query its database, return all events that match the filter, and keep applying the filter to all connections, returning new events as they arrive.
|
||||||
|
|
||||||
|
Subscriptions stay indefinitely open until either side closes the subscription or the connection.
|
||||||
|
|
||||||
### Subscription Requests
|
### Subscription Requests
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user