Skip to content
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

feat: Plugin API #1686

Open
3 tasks
weboko opened this issue Oct 24, 2023 · 1 comment
Open
3 tasks

feat: Plugin API #1686

weboko opened this issue Oct 24, 2023 · 1 comment
Assignees
Labels
enhancement New feature or request

Comments

@weboko
Copy link
Collaborator

weboko commented Oct 24, 2023

This is a feature request

Problem

At this point js-waku is in a position when it is good to be considered for new projects but still raw to be able to seamlessly plugin into any project. When consumer tries to use @waku/sdk they face either a need to write wrapper or to lear Waku concepts and adopt it as it is.

Our plan to address it is to have dedicated teams for specific uses but it still does not address all demand observed.

Proposed Solutions

To address it I propose to develop Plugin API. This would allow to develop some ecosystem around js-waku and offload implementation of adapters to community.

Possible API can look like:

import waku from "@waku/sdk";
import socketAdapter from "@waku/socket";
...
waku.use(socketAdapter); // extends types on waku node, unlocks 
...
waku.on("event", fn); // now we can do

Plugin API would help to simplify dependency graph of projects that are using js-waku.

In case someone (or core team) develops an adapter it would look like:

graph TD;
A[waku-sdk-v2] -->|import| D[consumer]
C[waku-sdk-v1] -->|import| B
B[waku-socket] -->|import| D
Loading

But with this API it will be simplified to:

graph TD;
A[waku-sdk-1] -->|import| D[consumer]
B[waku-socket] -->|import| D
A -->|use| B
Loading

Objectives

  • develop daft of design for Plugin API;
  • implement this API for @waku/sdk;
  • create template project for plugins;

Notes

Ref - Core plugin concepts in Chai

@fryorcraken fryorcraken added this to Waku Oct 24, 2023
@weboko weboko added the enhancement New feature or request label Oct 24, 2023
@weboko weboko self-assigned this Oct 24, 2023
@fryorcraken
Copy link
Collaborator

fryorcraken commented Oct 27, 2023

I assume we should implement #1463 this way? so that one could just use waku.filter.... but the plugin would automatically manage multiple subscriptions?
And the API would not change whether you use the plugin or not?

If so, then maybe this issue could be a good way to put this idea to the test.

@weboko weboko moved this to To Do in Waku Oct 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: To Do
Development

No branches or pull requests

2 participants