-
Notifications
You must be signed in to change notification settings - Fork 44
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
bug: publish messages without being subscribed #1207
Comments
I found this piece of code which check similar logic, wondering why is it not working in this case? |
I think it works 🙂 Check the logs I attached in status-im/status-go#5759 (comment) - The question is, should we maybe auto-subscribe to topic in such case. |
It seems we need a wrapper API for auto subscribe. what do you think? @richard-ramos |
it may not be so straight-forward, because when you subscribe to a pubsubtopic doesn't mean you have peers connected wrt topic. So, doing it as part of publish may not solve the issue rather mislead further. either we subscribe and wait to have atleast 1 peer for topic(which itself is not gauranteed msg will be reliably propagated). |
I agree with Prem's observations about creating a wrapper not being straightforward. Subscribing to the principle of least surprise, i'd rather have the publish function return an error and handle it appropriately.
IMO yes. Using topic health is a pending topic we have for go-waku / status-go integration, so perhaps this is a good moment to work on this task! |
As described in status-im/status-go#5759 (comment) by @igor-sirotin
The code as it is right now would allow publishing a message while not being subscribed to a pubsub topic.
I suggest either checking if a subscription to the pubsub topic before publishing and return an error or maybe attempt to subscribe with this code. I kinda prefer to return an error instead since then the user of the library can choose to subscribe or not depending on the error (and also because publishing without being subscribed does look like an incorrect usage of gowaku)
The text was updated successfully, but these errors were encountered: