-
Notifications
You must be signed in to change notification settings - Fork 3
Add Send API to Waku API #87
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 6 commits
55dfcf9
a25e3b9
8387ada
79a96a6
7cfc362
681f38a
b68082c
07e23fd
e7be2b4
c20f692
35dc6ac
c61574b
11bc90a
cfe7cdd
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -69,7 +69,7 @@ An alternative would be to choose a programming language. However, such choice m | |
| ### Primitive types and general guidelines | ||
|
|
||
| - No `default` means that the value is mandatory, meaning a `default` value implies an optional parameter. | ||
| - Primitive types are `string`, `int`, `bool`, `enum` and `uint` | ||
| - Primitive types are `string`, `int`, `bool`, `byte`, `enum` and `uint` | ||
| - Complex pre-defined types are: | ||
| - `object`: object and other nested types. | ||
| - `array`: iterable object containing values of all the same type. | ||
|
|
@@ -302,6 +302,109 @@ If the `mode` set is `core`, the initialised `WakuNode` SHOULD use: | |
| `edge` mode SHOULD be used if node functions in resource restricted environment, | ||
| whereas `core` SHOULD be used if node has no strong hardware or bandwidth restrictions. | ||
|
|
||
| ## Send messages | ||
|
|
||
| #### Type definitions | ||
|
|
||
| ```yaml | ||
| types: | ||
| SendMessage: | ||
| type: object | ||
| fields: | ||
| contentTopic: | ||
weboko marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| type: string | ||
| description: "Content-based filtering field as defined in [TOPICS](https://github.com/vacp2p/rfc-index/blob/main/waku/informational/23/topics.md#content-topics)" | ||
| payload: | ||
| type: array<byte> | ||
| description: "The message data to be sent." | ||
| ephemeral: | ||
weboko marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| type: bool | ||
| default: false | ||
| description: "Whether the message is ephemeral. Read at [ATTRIBUTES](https://github.com/vacp2p/rfc-index/blob/main/waku/standards/core/14/message.md#message-attributes)" | ||
|
|
||
| RequestId: | ||
| type: string | ||
| description: "A unique identifier for a request" | ||
weboko marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| ``` | ||
|
|
||
| #### Function definitions | ||
|
|
||
| ```yaml | ||
| functions: | ||
| send: | ||
| description: "Send a message through the network." | ||
| parameters: | ||
| - name: message | ||
| type: SendMessage | ||
| description: "The message to send" | ||
| returns: | ||
| type: result<RequestId, error> | ||
weboko marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| ``` | ||
weboko marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| #### Extended definitions | ||
|
|
||
| When `message` is sent with `contentTopic` for the first time, | ||
| the node SHOULD trigger a subscription based on `Subscribe to messages` section. | ||
weboko marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| The node uses [P2P-RELIABILITY](/standards/application/p2p-reliability.md) strategies to ensure message delivery. | ||
|
|
||
| ## Event source | ||
|
|
||
| #### Type definitions | ||
|
|
||
| ```yaml | ||
| types: | ||
| MessageSentEvent: | ||
| type: object | ||
| fields: | ||
| eventType: | ||
| type: string | ||
| default: "message:sent" | ||
| description: "Event type identifier" | ||
|
||
| requestId: | ||
| type: RequestId | ||
| description: "The request ID associated with the sent message" | ||
weboko marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| MessageErrorEvent: | ||
| type: object | ||
| fields: | ||
| eventType: | ||
| type: string | ||
| default: "message:error" | ||
| description: "Event type identifier" | ||
| requestId: | ||
| type: RequestId | ||
| description: "The request ID associated with the failed message" | ||
| error: | ||
| type: string | ||
| description: "Error message describing what went wrong" | ||
|
|
||
| MessageAckEvent: | ||
weboko marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| type: object | ||
| fields: | ||
| eventType: | ||
| type: string | ||
| default: "message:ack" | ||
| description: "Event type identifier" | ||
| requestId: | ||
| type: RequestId | ||
| description: "The request ID associated with the acknowledged message" | ||
| ackType: | ||
| type: string | ||
| description: "Type of acknowledgment (e.g., 'store', 'filter')" | ||
|
|
||
| EventSource: | ||
| type: object | ||
| description: "Event source for message-related events" | ||
| fields: | ||
| onEvent: | ||
weboko marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| type: function | ||
| description: "Callback for message:sent events" | ||
weboko marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| parameters: | ||
| - name: event | ||
| type: MessageSentEvent | MessageErrorEvent | MessageAckEvent | ||
weboko marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| ``` | ||
|
|
||
| ## The Validation API | ||
|
|
||
| [WAKU2-RLN-RELAY](https://github.com/vacp2p/rfc-index/blob/main/waku/standards/core/17/rln-relay.md) is currently the primary message validation mechanism in place. | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.