mirror of
https://github.com/logos-messaging/specs.git
synced 2026-01-05 23:53:12 +00:00
Proposed different format to express message events
Changes: - `eventType` field is part of the event data, which does not really match how it's done in JS - `eventType` has a `default` value. Does not really make sense as it's not something the API consumer can pass/change - `addEventListener` is defined, but this is JS specific, the API should define concepts in a generic manner so it can easily be applied across languages. - name`EventEmitter` is very generic, but this is an event emitter for messages only - new `properties` field was introduced, but it is unclear where these properties belong to, we have been using `fields` so far. This should be a field on `WakuNode`
This commit is contained in:
parent
c20f692a13
commit
d05209e837
@ -29,6 +29,12 @@ contributors:
|
|||||||
* [Function definitions](#function-definitions)
|
* [Function definitions](#function-definitions)
|
||||||
* [Predefined values](#predefined-values)
|
* [Predefined values](#predefined-values)
|
||||||
* [Extended definitions](#extended-definitions)
|
* [Extended definitions](#extended-definitions)
|
||||||
|
* [Send messages](#send-messages)
|
||||||
|
* [Type definitions](#type-definitions-1)
|
||||||
|
* [Function definitions](#function-definitions-1)
|
||||||
|
* [Extended definitions](#extended-definitions-1)
|
||||||
|
* [Event source](#event-source)
|
||||||
|
* [Type definitions](#type-definitions-2)
|
||||||
* [The Validation API](#the-validation-api)
|
* [The Validation API](#the-validation-api)
|
||||||
* [Security/Privacy Considerations](#securityprivacy-considerations)
|
* [Security/Privacy Considerations](#securityprivacy-considerations)
|
||||||
* [Copyright](#copyright)
|
* [Copyright](#copyright)
|
||||||
@ -118,6 +124,10 @@ types:
|
|||||||
WakuNode:
|
WakuNode:
|
||||||
type: object
|
type: object
|
||||||
description: "A Waku node instance."
|
description: "A Waku node instance."
|
||||||
|
fields:
|
||||||
|
messages:
|
||||||
|
type: MessageEventEmitter
|
||||||
|
description: "Event source for message-related events"
|
||||||
|
|
||||||
NodeConfig:
|
NodeConfig:
|
||||||
type: object
|
type: object
|
||||||
@ -224,15 +234,6 @@ functions:
|
|||||||
type: result<WakuNode, error>
|
type: result<WakuNode, error>
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Property definitions
|
|
||||||
|
|
||||||
```yaml
|
|
||||||
properties:
|
|
||||||
events:
|
|
||||||
type: EventEmitter
|
|
||||||
description: "Event source for message-related events"
|
|
||||||
```
|
|
||||||
|
|
||||||
#### Predefined values
|
#### Predefined values
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
@ -366,10 +367,6 @@ types:
|
|||||||
MessageSentEvent:
|
MessageSentEvent:
|
||||||
type: object
|
type: object
|
||||||
fields:
|
fields:
|
||||||
eventType:
|
|
||||||
type: string
|
|
||||||
default: "message:sent"
|
|
||||||
description: "Event type identifier"
|
|
||||||
requestId:
|
requestId:
|
||||||
type: RequestId
|
type: RequestId
|
||||||
description: "The request ID associated with the sent message"
|
description: "The request ID associated with the sent message"
|
||||||
@ -380,10 +377,6 @@ types:
|
|||||||
MessageErrorEvent:
|
MessageErrorEvent:
|
||||||
type: object
|
type: object
|
||||||
fields:
|
fields:
|
||||||
eventType:
|
|
||||||
type: string
|
|
||||||
default: "message:error"
|
|
||||||
description: "Event type identifier"
|
|
||||||
requestId:
|
requestId:
|
||||||
type: RequestId
|
type: RequestId
|
||||||
description: "The request ID associated with the failed message"
|
description: "The request ID associated with the failed message"
|
||||||
@ -397,10 +390,6 @@ types:
|
|||||||
MessagePropagatedEvent:
|
MessagePropagatedEvent:
|
||||||
type: object
|
type: object
|
||||||
fields:
|
fields:
|
||||||
eventType:
|
|
||||||
type: string
|
|
||||||
default: "message:propagated"
|
|
||||||
description: "Event type identifier"
|
|
||||||
requestId:
|
requestId:
|
||||||
type: RequestId
|
type: RequestId
|
||||||
description: "The request ID associated with the propagated message in the network"
|
description: "The request ID associated with the propagated message in the network"
|
||||||
@ -408,16 +397,19 @@ types:
|
|||||||
type: string
|
type: string
|
||||||
description: "Hash of the message that got propagated within the network"
|
description: "Hash of the message that got propagated within the network"
|
||||||
|
|
||||||
EventEmitter:
|
MessageEventEmitter:
|
||||||
type: event_emitter
|
type: event_emitter
|
||||||
description: "Event source for message-related events"
|
description: "Event source for message-related events"
|
||||||
fields:
|
events:
|
||||||
addEventListener:
|
"message:sent":
|
||||||
type: function
|
type: MessageSentEvent
|
||||||
description: "Callback for subscribing to events"
|
description: "Emitted when a message has been sent over the wire."
|
||||||
parameters:
|
"message:error":
|
||||||
- name: event
|
type: MessageErrorEvent
|
||||||
type: MessageSentEvent | MessageErrorEvent | MessagePropagatedEvent
|
description: "Emitted when an error was encountered when sending a message."
|
||||||
|
"message:propagated":
|
||||||
|
type: MessagePropagatedEvent
|
||||||
|
description: "Emitted when indication that the message was propagated among p2p nodes has been received."
|
||||||
```
|
```
|
||||||
|
|
||||||
## The Validation API
|
## The Validation API
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user