feat: Waku API's subscribe#2667
Conversation
Introduced a new `subscribe` function to the Waku API.
|
My intention was to go a bit different direction: type WakuMessage = {
Payload: Uint8Array;
ContentTopic: string;
Ephemeral: bool;
// maybe some other fields
};
type MessageListener = (event: CustomEvent<WakuMessage>) => void;
Interface IWaku {
subscribe(contentTopic: string, cb: MessageListener): void;
}What I propose is not ready yet, but first steps are set in #2583 in Another hard restriction, I think we have, is that As for which approach to use - Internals of All in all I think |
|
This is small POC how I see it #2671 |
Why?
Yes, this present PR adds |
I am suggesting Actually, looking at the current API, we can do better by handling both errors and message via event listener to get the smooth UX. |
Introduced a new
subscribefunction to the Waku API.Problem / Description
Developer need a simple API to receive messages.
Solution
See TODOs / Notes
API
Usage
TODOs / Notes
Specs: logos-messaging/specs#86
Related to #2216
Checklist