-
Notifications
You must be signed in to change notification settings - Fork 440
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
add example filter subscription #720
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this example would fit better inside the pubsub examples folder, as the second example
examples/pubsub-filter/1.js
Outdated
} | ||
|
||
//validate fruit | ||
node1.pubsub._pubsub.topicValidators.set(topic, validateFruit); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@wemeetagain @jacobheun we should provide a friendly API for this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@vasco-santos can you open a new issue to discuss the pubsub abstraction we currently have in place here? I think we should look at getting rid of it or finding a cleaner way to support direct access to various modules. The API is unnecessarily restrictive atm.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, of course
Do I place each example as two different folders or two examples in the same folder? |
I think it should live under the pubsub examples folder. But, let's wait for @jacobheun feedback |
We can just move it into |
Done |
I cleaned up some language and merged this via a331b84. Thanks for the PR! |
I made this example to show how to put an additional filter on pubsub. So each node can verify that the message is valid before sharing it with the other nodes. This helps not to overload the network in cases where the node can check the validity of the messages by itself.