Sending message only to full message peers using Gossipsub

Hi, I’m fairly new to libp2p and I’ve been playing around with Gossipsub, I wanted to ask if there is a way to send a message to just the peers a node is directly connected to and not broadcast it to the whole network?

Could you explain better why you want to do this?

But that’s not the purpose of gossip, you should create a protocol that works the way you want

I wanted to try implementing a way for peers subscribed to the same topic to share files between each other where the file is coppied to the peers immediately connected to it and as the file gets requested by other peers on the network it is propagated and coppied to other peers throughout the network as other users request them.

I think i could probably just set up separate streams connecting to the immediate connected peers i would just need a way of getting a list of the full message peers. I’m just having a hard time finding a way to send a message to just the full message peers and not have it be propagated through the whole network.

You can use pubsub just to publish the cid of the file. Also, you can use bitswap to recover the file back.
This way you can propagate the file’s cid to everyone and they use Bitswap to share it.

1 Like