Giter Club home page Giter Club logo

Comments (7)

vasco-santos avatar vasco-santos commented on June 15, 2024 1

Can you provide us a test case for this?
I locally tried go node with js node using gossipsub (directly connected), and after subscribing I could receive the messages as expected.

from js-libp2p-gossipsub.

vasco-santos avatar vasco-santos commented on June 15, 2024

They will be able to receive the messages, but it will depend on how your overlay network is defined.

You will need to be connected to a set of libp2p nodes sharing the same pubsub topic interests, in order to receive the message. How are you establishing your node connectivity and peer discover, and how will they discover go nodes? Moreover, are you using this on Node.js or browser node?

from js-libp2p-gossipsub.

iNDicat0r avatar iNDicat0r commented on June 15, 2024

I connect them directly to each other using peerstore and dial and they still don't receive messages. I am using electron which is executed in context of nodejs.

from js-libp2p-gossipsub.

jerradpatch avatar jerradpatch commented on June 15, 2024

I have this same issue, I cannot get the data to be received in a simple test

import Gossipsub from 'libp2p-gossipsub';
import Libp2p from 'libp2p';

test('exact reporoduction of gossip', async (done)=>{
    const Gossipsub = require('libp2p-gossipsub');
    const options = {emitSelf: true, gossipIncoming: true};
    const node1= await createNodeExact();
    const node2 = await createNodeExact();
    // await node1.start();
    // await node2.start();

    const gsub1 = new Gossipsub(node1, options);
    const gsub2 = new Gossipsub(node2, options);

    await gsub1.start();
    await gsub2.start();

    gsub1.on('fruit', (data) => {
      console.log(data)
      done();
    });
    gsub1.subscribe('fruit');

    gsub2.publish('fruit', new TextEncoder().encode('banana'))
  }, 20e3);
  
  async function createNodeExact() {
    const transportKey = TCP.prototype[Symbol.toStringTag];
    const defaultConfig = {
      addresses: {
        listen: ['/ip4/0.0.0.0/tcp/0']
      },
      modules: {
        transport: [TCP],
        streamMuxer: [MPLEX],
        connEncryption: [NOISE],
        peerDiscovery: [MulticastDNS],
        pubsub: Gossipsub
      },
      config: {
        pubsub: {
          emitSelf: true,
          enabled: false
        },
        peerDiscovery: {
          autoDial: true,
          [MulticastDNS.tag]: {
            interval: 1000,
            enabled: true
          }
        },
        transport: {
          [transportKey]: {
            filter: filters.all
          }
        }
      }
    };

    return Libp2p.create(defaultConfig);
  }
  

from js-libp2p-gossipsub.

vasco-santos avatar vasco-santos commented on June 15, 2024

Hey @jerradpatch

For your nodes to be able to properly exchange messages they need to be connected to a set of common peers (you can look into the spec: https://github.com/libp2p/specs/blob/master/pubsub/gossipsub/gossipsub-v1.0.md). If the peers are directly connected to each other, they will be able to to exchange pubsub messages without any problems, but if they are not they will need to have the minimum number of common connected peers to be able to exchange pubsub messages reliably. You can see the tests in https://github.com/ChainSafe/js-libp2p-gossipsub/blob/master/test/go-gossipsub.js for tests that create these connectivity scenarios, denseConnected and sparseConnect

from js-libp2p-gossipsub.

stale avatar stale commented on June 15, 2024

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions.

from js-libp2p-gossipsub.

stale avatar stale commented on June 15, 2024

This issue or pull request has been automatically been closed due to inactivity.

from js-libp2p-gossipsub.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.