mirror of
https://github.com/nostr-protocol/nips.git
synced 2024-11-09 22:09:06 -05:00
nip200: idea for chunked stream by mattn
Signed-off-by: Yonle <yonle@lecturify.net>
This commit is contained in:
parent
246539288d
commit
f540cf8c49
3
11.md
3
11.md
|
@ -277,7 +277,8 @@ URL Paths to NoH endpoints.
|
|||
"req": "http://my-relay/__nostr/req",
|
||||
"count": "http://my-relay/__nostr/count",
|
||||
"publish": "http://my-relay/__nostr/pub",
|
||||
"auth": "http://my-relay/__nostr/auth"
|
||||
"auth": "http://my-relay/__nostr/auth",
|
||||
"stream": "http://my-relay/__nostr/stream"
|
||||
},
|
||||
...
|
||||
}
|
||||
|
|
21
200.md
21
200.md
|
@ -14,13 +14,14 @@ Relays may expose NoH endpoints that client could reach. Client may make HTTP re
|
|||
|
||||
Relays must ensure that the NoH endpoints **MUST** be served with `Access-Control-Allow-Origin: *` header to ensure it can be validated by pure JS apps running in modern browsers.
|
||||
|
||||
### From client to relay: getting events and sending event
|
||||
### From client to relay: fetching and sending event(s)
|
||||
|
||||
Client could make a request to `req`, `count` or `publish` endpoint that were specified in `/.well-known/nostr.json`
|
||||
Client could make a request to `req`, `count`, `publish`, or `stream` endpoint that were specified in `/.well-known/nostr.json`
|
||||
|
||||
When fetching events, Client can optionally specify filters directly into the URI search query:
|
||||
- `<count>?<filter>`, or
|
||||
- `<req>?<filter>`
|
||||
- `<count>?<filter>`,
|
||||
- `<req>?<filter>`, or
|
||||
- `<stream>?<filter>`
|
||||
|
||||
`<filter>` is a querystrings that determines what events will be received in that request. it can have the following attributes:
|
||||
|
||||
|
@ -38,6 +39,7 @@ Request URL Examples:
|
|||
- `https://my-relay.com/__nostr/req?kinds=0,1&limit=10`
|
||||
- `https://my-relay.com/__nostr/req?authors=12345,67890`
|
||||
- `https://my-relay.com/__nostr/count?count=100&authors=12345,kinds=0`
|
||||
- `https://my-relay.com/__nostr/stream?since=12345&kinds=0,1&limit=10`
|
||||
|
||||
To send event to relay, Client will need to make POST request to `publish` endpoint with POST body containing the JSON blob of the event.
|
||||
|
||||
|
@ -54,3 +56,14 @@ At certain condition, Relay will also respond with HTTP status code:
|
|||
- `200`: OK / Success
|
||||
- `400`: Invalid Request
|
||||
- `500`: Relay/Server error
|
||||
|
||||
### From relay to client: streaming events to client
|
||||
|
||||
Relay may start streaming to client when connected to `stream` endpoint by sending chunked JSON blob of events until reached to `limit` that being set by client.
|
||||
|
||||
```
|
||||
{ "id": ..., "content": .... }
|
||||
{ "id": ..., "content": .... }
|
||||
{ "id": ..., "content": .... }
|
||||
{ "id": ..., "content": .... }
|
||||
```
|
||||
|
|
Loading…
Reference in New Issue
Block a user