-
Notifications
You must be signed in to change notification settings - Fork 3
Add Send API to Waku API #87
Changes from 7 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
|
||
| 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.
|
||
| 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.
|
||
| ``` | ||
|
|
||
| #### 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.
|
||
| ``` | ||
|
weboko marked this conversation as 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
|
||
|
|
||
| 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" | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am not sure I agree with this syntax. WDYM by I would suggest to opt for the syntax proposed in https://github.com/waku-org/specs/pull/86/files The object that emit events, define the "topics" of the events (eg types:
EventEmitter:
type: event_emitter
description: "An event emitter for general node events."
events:
"error:subscribe":
type: string
description: "Event emitted when subscription to a content topic irremediably fails. The event contains an error message."And here, if you want you can have
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
I meant that I don't understand this syntax: what is for the syntax I used wdyt @fryorcraken |
||
| requestId: | ||
| type: RequestId | ||
| description: "The request ID associated with the sent message" | ||
|
weboko marked this conversation as resolved.
Outdated
|
||
|
|
||
| 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" | ||
|
|
||
| MessagePropagatedEvent: | ||
| type: object | ||
| fields: | ||
|
weboko marked this conversation as resolved.
|
||
| eventType: | ||
| type: string | ||
| default: "message:propagated" | ||
| description: "Event type identifier" | ||
| requestId: | ||
| type: RequestId | ||
| description: "The request ID associated with the propagated message in the network" | ||
| messageHash: | ||
| type: string | ||
| description: "Hash of the message that got propagated within the network" | ||
|
|
||
| EventSource: | ||
| type: object | ||
| description: "Event source for message-related events" | ||
| fields: | ||
| onEvent: | ||
|
weboko marked this conversation as resolved.
Outdated
|
||
| type: function | ||
| description: "Callback for message:sent events" | ||
|
weboko marked this conversation as resolved.
Outdated
|
||
| parameters: | ||
| - name: event | ||
| type: MessageSentEvent | MessageErrorEvent | MessageAckEvent | ||
|
weboko marked this conversation as resolved.
Outdated
|
||
| ``` | ||
|
|
||
| ## 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.