Help Kubo maintainers about usecases for the HTTP PubSub API

Hey we are planning to kill the /api/v0/pubsub/* RPC API in Kubo 0.20 (expected to release in ~5 weeks), (see Deprecate then Remove the PubSub HTTP API · Issue #9717 · ipfs/kubo · GitHub).

The TL;DR is that the PubSub API does not expose the required options to make an effective mesh (validators, algorithm tweaking, …) and that it make more sense for consumers to write the ~20 lines of Go code required to create a Libp2p node and run go-libp2p-pubsub on top of this node rather than implement a huge rube goldberg machine that expose the required callback over Kubo’s HTTP API.

We want to be sure we are not missing a usecase, so if you have any comments about our migration plan please raise them here or in the github issue. We also want to know what are the usecases you have if you are using the PubSub HTTP API.
Thx

3 Likes

I mean, I think the main use case is access to the pubsub API for projects that aren’t written in golang. It’s about having a programming-language-agnostic API to access pubsub functionality (via HTTP).

WHAT!

My entire project use Kubo pubsub. I use it to listen to IPNS updates for live chat & live stream and future CRDTs or DB update.

I would have to run an IPFS node AND a libp2p node, how does that make sense? IPFS IS a libp2p node.

As for the Brave browser they only have an IPFS node and so would lose any way of doing live update.

@SionoiS we are not gonna remove IPNS or IPNS over PubSub. We are gonna remove the low level PubSub API /api/v0/pubsub/*.

Sounds like you could move the IPFS part of your app from Kubo to your inside your app.
I belive apps become much better when you do that because you have a consistent type system and environment. This can be hard to do today, that why we are working on go-libipfs and go-libipfs’s example.

You could run a wasm or helia (/ js-libp2p) node that do webrtc & webtransport.
This used to be impossible due to mixed content issues and the lack of good browser to browser connections (webrtc-star :sob: ) but thoses issues were recently solved (/ or are close to be).

True, we are gonna provide a binary that provides the same features (you could also easily fork Kubo to revert the pubsub changes).
You will have to write a bit of Go if you want to access lower levels go-libp2p-pubsub options tho (go is really easy boring language so as long as this is small it should be fine ?).

I was using the pubsub API to “follow” an IPNS address. Maybe you guys could add that functionality?

True, but that’s a lot of work. Hopefully it will be easier with IPFS as a lib.

Yes I like all those new possibilities but it’s not the same as accessing a long running node.

I’m just sad that my project won’t work as well until I fix all this.

1 Like

Is this for real ? I’ve read the issue and understand the reasons, but wonder if there isn’t a compromise that could be reached ? The idea of using a websocket sounds pretty good.

I think there’s quite a lot of applications that use kubo’s pubsub HTTP API without major issues. Yes, message delivery isn’t perfect but the API is pretty straightforward and provides an easy communication system between nodes. I think that pubsub should be a core feature of IPFS, especially for the kubo implementation. But if pubsub support can be installed as a plugin it’s not so bad.

2 Likes

It’s best to have a drop-in replacement solution using libp2p if this is happening. So much things will be broken.

1 Like

Websockets would make the reading of message pretty good which is not the problem that sparked all of this.

The main issue here is that a good pubsub mesh require to make decision on which messages are relayed, this is a thing Kubo hides from you with the SeenMessageCache which is a terrible solution (use lots of CPU, does not scale, is not resilient).
Vyzo wrote a new better default that would only accept increasing nonces and store them in a DB, but that somehow broke compat with js-ipfs (this is also not a silver bullet and only solve some particular problems), this breaks some behaviours, for example before if messages where out of order you would get both messages, now you only get the second one because the first one have a nonce that is higher blocking the first one to get through.

Ideally you users make the decision of how to validate message, because each app is slightly different.
This is implemented with callback, and doing callbacks over HTTP is not really a thing. We would need some complex machine, probably something where your app register an http handler endpoint and when the callback is called arguments are serialised and kubo do an HTTP call to your app. Other solutions are possible but they all comeback to kubo calling your app from time to time, which is not easy to write, or to use.

Turns out there this thing called the Go ABI, it already supports callback, it’s performant and somewhat intuitive to use. It’s also really easy to write (it’s just part of the language, you just pass a function pointer).

Free engineer time is at a premium, there is no good solution that makes everyone happy, so I think our time is better spent allowing users to make their own application aware choices and tradeoffs for this complex problem of message validation rather than maintaining something that always a bit broken, because something that always a bit broken is something that always generate new github issues.

If you are happy with the current solution there will be a binary the expose the same API but I hope most peoples wont use this because I don’t think this is a good implementation of pubsub.

1 Like