Manually subscribing to namesys-pubsub events

What I’m trying to do: piggyback on the namesys pubsub system to react to new ipfs name publish.

I’ve got two peers PeerA and PeerB with both pubsub and namesys-pubsub enabled:

ipfs daemon --enable-pubsub-experiment --enable-namesys-pubsub

I’m successfully doing this on PeerA:

ipfs add -r public/rngadam # last row has CID
ipfs name publish --key=$USER $CID

and I can list the content on PeerB.

What I’d like is also have PeerB reacts to the changes on my public key publishing.

I see that:

ipfs name pubsub subs

returns a list of subscriptions of type /ipns/$PUBLIC_KEY

but if I try to on PeerB to have:

ipfs pubsub sub /ipns/$PUBLIC_KEY

I don’'t get any events.

Is it doable? I’d rather not have to create a separate pubsub channel with artificial events on top of something that’s already happening behind the scenes.

1 Like

I think it is doable but the channel might not be /ipns/$public_key (not sure). And the items that are broadcasted are probably binary protobufs.

do you know where I could look this up to understand how name uses pubsub? the content of the items broadcasted doesn’t really matter as long as I could use them as indication that something was published (without polling manually).

Actually, ipfs pubsub ls shows all topics to which pubsub is subscribed, including the IPNS ones.

1 Like

ah right, so those prefixed with /record. Guess I can keep another ipfs pubsub sub on that whole list and reload on notification changes. Thanks!