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

Gossip Message for indirect peers #174

Open
sujith2s opened this issue Feb 1, 2021 · 4 comments
Open

Gossip Message for indirect peers #174

sujith2s opened this issue Feb 1, 2021 · 4 comments

Comments

@sujith2s
Copy link

sujith2s commented Feb 1, 2021

Hello,

Interested in libp2p projects, i was experimenting the gossipsub.. When host is directly connected to the other host then only i am able to receive the message from the peer.

If connection as follows

A -> B and B->C
and A and C are subscribed to a topic.
A sends a message to the topic, not receiving at C, until unless B also subscribes to the same topic.

condion is floodPublish false and gossipPeerScoreParam isDirect= false

Tried with floodPublish= true and is_direct = true also.
But result is the same.
Is there something i am missing?
Any leads will be highly appreciated.

@Nashatyrev
Copy link
Collaborator

Hey @sujith2s, yep in the gossip network peers not subscribed to a topic don't participate in message dissemination for that topic. The only exception is that you may publish messages for a topic even if you are not subscribed to it: so called fanout feature.

floodPublish - means your own message would be published to all peers subscribed to this message topic. Else the message would be published just to peers in your gossip mesh for this topic.

@sujith2s
Copy link
Author

sujith2s commented Feb 2, 2021

@Nashatyrev thank you for the prompt reply and it helps.

I was little confused with the fanout feature you mentioned, is there a way we can achieve it?
what all the parameters i need to use?

I tried to debug the code, when the floodpublish = false and the is_direct = false and following is the observations

  1. I tried to send a message its not reaching any of the peers it connected to. ( topic not subscribed)
  2. And noticed that if any of the connected peers is subscribed to the topic, then its get delivered.
  3. Also if a peer subscribe to a topic, the subscription details are shared only with the connected peers its not gossiped, is it expected?

So what I found was a peer should know the subscription details to send the message, but the subscription details are shared only to the connected peers.
So the problem I am facing is how to send message to a indirect peer who subscribed to a topic.
In case of
A->B->C
C subscribed to a topic and A want to send a message, what all parameter I should set.

Thanks in advance.

@Nashatyrev
Copy link
Collaborator

I was little confused with the fanout feature you mentioned, is there a way we can achieve it?
what all the parameters i need to use?

From the gossip spec :

fanout, like mesh, is a map of topics to a set of peers, however, the fanout map contains topics to which we are not subscribed.

You need not set up any params for using it. It is enabled by default and I'm not sure it could be of a large interest in your potential scenario.

Also if a peer subscribe to a topic, the subscription details are shared only with the connected peers its not gossiped, is it expected?

Right. Any peer (in boundaries of gossip protocol) knows only about its connected peers. No further.

So the problem I am facing is how to send message to a indirect peer who subscribed to a topic.

The pubsub is generally the protocol not intended to send a message to a specific peer. It's about broadcasting a message across peers subscribed to a concrete topic. A peer wishing to listen for messages (or publications) on a specific topic should find and connect to peers subscribed to this topic.

What is your exact scenario?

Also I would suggest you to look through the gossip spec. It could likely answer some of your questions

@sujith2s
Copy link
Author

sujith2s commented Feb 5, 2021

@Nashatyrev thanks for the detailed explanation and it was very helpful.

Got interested in libp2p, so tried some a chat app using the go port with kad dht as routing table.
And everything works smooth.

So thought of checking it in a java port, but jvm side i couldn't find kad or any dht implementation support, correct me if i am wrong.

Mdns i could find for local peer discovery, so tried connecting to peers and tried the gossip.
But it gets connected to all the peers in the local network, want to restrict the connection using some counter and tried the gossip part, didn't work.

Do you have any suggestion for a replacement for Kad DHT in jvm port. So both will work in sync and topic discovery and connection to the topic peers.

Thank you for your time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants