-
Notifications
You must be signed in to change notification settings - Fork 47
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
js gossipsub not working in browser. #381
Comments
maybe show us |
I had attached the link for the implementation along with the issue. here it is again. |
ah ok, sorry, i didn't actually click that link at first because "as shown here" sounded like you're mentioning a tutorial, not your own code :'D but yeah the line in question is the node.pubsub.addEventListener("message", (evt) => {
console.log(`node1 received: ${uint8ArrayToString(evt.detail.data)} on topic ${evt.detail.topic}`)
}) which doesn't contain setInterval(async () => {
await node.pubsub.publish(topic, uint8ArrayFromString('Bird bird bird, bird is the word!'))
}, 5000) i don't know how exactly the error seems to happen in https://github.com/ChainSafe/js-libp2p-gossipsub/blob/master/src/utils/buildRawMessage.ts#L40, so that's frankly not sure what's happening there, your code does look fine, but i'm doing almost the exact same thing over there and there in the browser; and there on nodejs, feel free to compare or whatever, maybe that helps :/ note i'm not actually using the official |
In the repository i linked, i also created a node.js implementation using the same logic. which worked fine. Thats why it felt quite wierd when the it didnt work on browser side. |
literally the only difference i needed between browser and nodejs was that the browser version of |
actually i just noticed something: you discover every bootstrap node every 100ms while a comment claims that "autoDial is on" (but it's not in your options object)... might wanna check if actually turning it on does something for you, or if it's the extremely short bootstrap interval that's messing with you (it's about a tenth to a hundredth of every other peer-related timer after all) btw that same comment also claims that "autodial is on" is the reason there's "no need to dial" every single discovered peer ever immediately, but the real reason for that is actually that it would nuke your network to hell and back and screw with every single libp2p subsystem involved :P |
ahh .. yea i was tinkering with those timings.. i did test with the larger values before I pushed the code with the smaller autodial. Which also gave the same error on publish :( |
that's not a smaller autodial timer though. that's no autodial config whatsoever as far as i can tell and a smaller bootstrap-fake-discovery timer. so every few seconds autodial might (or not, depending on the defaults) happen but that's already after you "discovered" the same list of peers 10-100 times since the last time, that might confuse it a lot. also note that after starting the node you ping (NOT dial!) a hardcoded address, presumably to see whether you can still reach the webrtc-star server (because, again, you're not gonna make any long-living connection with that, and definitely none that gossipsub will be aware of!), and then just scream into the void. but then again, neither of those issues should technically mess with the |
See this #368 |
|
nice.. glad it only took 2 years ;) |
Hello,
I created a basic gossipsub implementation as shown here. Heavily referencing the examples . I am always getting this error when trying to publish a message using gossipsub.
I am using libp2p with the basic create-react-app template.
The text was updated successfully, but these errors were encountered: