What i’m trying to do is the following.
I want a website to interact with the IPFS PubSub mechanism. The website should listen to a specific PubSub channel. If an IPFS client posts a message on that specific channel, the site should receive it. And vice versa.
The usecases for this are broad! For instance, think about the following:
- Messaging app
- or pinterest where, upon browsing, the client requests the next batch from the server.
- or a news/post/forum site where the client is notified of a new post to download and display
- or a wallpaper site where clicking on a thumbnail asks the PubSub channel which hash belongs to full sized version
In my very specific usecase i have a site where i want to show some data about movies and series. I first want the user to type in the search query and then fetch the relevant content from “the server”. The “server” here is running a full IPFS node and is subscribed to a specific channel. The client (the website) is also subscribed to the same channel. Both should communicate.
The working principle of this is Socket.io. It works. But the downside is that i need to provide an address there. The complexity becomes a little more when the server is placed in a local network environment. I do not want to provide any addresses as that only is annoying when i change hosts. IPFS is very well suited for this, i think.
Now i thought the
libp2p-webrtc-star project was the one that would be able to do this. I had set it up (you can see it at star.sc2.nl). I thought it would serve as a kind of proxy between the backend IPFS host where the
libp2p-webrtc-star would be connected to and the site which would be connected to
libp2p-webrtc-star. But this proved to be a wrong assumption apparently. Using this project you can connect to other
libp2p-webrtc-star nodes, not to IPFS client nodes.
So again, i’m looking for a way to connect IPFS client PubSub to a website.
I’m kind of lost at the moment at what i can still try to get this working.
Perhaps others have bright ideas the get the above desired solution working? I’m fine if i need an intermediary proxy (like star.sc2.nl, but then apparently not with libp2p-webrtc-star).
Also, if you have suggestions for me to try, please be verbose in the examples. I’ve spend way too much time trying to get
libp2p-webrtc-star to work (composed from a bunch of different snippets) to figure out that it’s not suitable for my intention. And as i’m now apparently in a very niche area of IPFS, documentation is very difficult to find if existing at all. Therefore, please, be verbose