How to use ipfs name pubsub

So I see under the ipfs name pubsub the subcommands cancel, state and subs that allow you to manage subscriptions but how exactly do you add a subscription to the ipns pubsub resolver?

1 Like

I think it’s published automatically as a part of the call to ipfs name publish and it’s subscribed automatically with ipfs name resolve there just isn’t any indication of this in the documentation.

@zacharywhitley a subscription is made if you have IPNS over pubsub enabled, which is not by default.

When you do ipfs name resolve {CID} you will subscribe to that CID. This means, next time you resolve, you will be able to resolve IPNS records way faster as they will be already stored locally.

I’m just kicking around with it but I definitely have pubsub enabled on the daemon with --enable-pubsub-experiment but I’m getting the following when running ipfs name pubsub subs

Error: IPNS pubsub subsystem is not enabled

Any idea what’s happening? Is there a separate flag for IPNS pubsub?

You need --enable-pubsub-experiment and --enable-namesys-pubsub

1 Like

Just messing around with the cli and name pubsub it would be nice if ipfs name pubsub ls included numeric references to the entries so that it would be a little easier to remove them without having to copy paste CID’s

ipfs pubsub ls

then you have to copy paste /record/l2jdfjdfdkffdjl to do

ipfs pubsub cancel /record/l2jfdjkdjfafjs

instead it would be nice if it did something like

ipfs pubsub ls
[1] /record/l2jdfjkdkjdfjdfjkfdj

and you could delete it with

ipfs pubsub cancel 1

I know PR’s are always welcome. Just throwin’ it out there.

Given that the list can change, I suspect that simply indexing it won’t really be feasible. But I have not looked into any of the details of this request.

Good point. Handn’t thought of that. Maybe a bash auto complete script. Wouldn’t even require any changes to IPFS.

Bash auto complete would be nice to have in general.

Looks like there is a bash completion script (for anyone coming across this in the future) go-ipfs/ at master · ipfs/go-ipfs · GitHub