Python Public/Subscribe Server & Client

Hello,

I’m using the Python client to communicate with my Go IPFS daemon. This works very well. I have switched the daemon with “–enable-pubsub-experiment” to use the public/subscribe experimental feature and run the “ipfs daemon” call within a Python subprocess to start the daemon with my Python program.

I have got two question:

  1. How can I use the public/subscribe mechanism within the Python “ipfsapi”, to create channels and receive messages from the subscribed channels?
  2. Is there a Python server component to run the IPFS server daemon as native Python application. I have found out that is in a current developing process. I think to run the IPFS daemon within a subprocess is not the best solution at the moment

Thanks a lot

Maybe you want to look at libp2p instead of ipfs pubsub specifically.

How can I use libp2p with the IPFS experimental feature? If I understood it correct, I get a hash value for each IPFS pub/sub channel and I use this hash to connect with libp2p? At the moment I’m using the py-ipfs-api only
Is there any tutorial which explains the usage of pub/sub mechanism with Python?

Thanks

I am sorry I am not sure. I could help with Go or Javascript.

Maybe somebodyelse will help.
Try asking in the Matrix chatrooms, maybe somebody there can help

Hello flashpix.

Regarding your first question: not sure ipfsapi has pubsub support. I wrote aioipfs which is an async client library to access an IPFS daemon (works with python3’s asyncio) and it has pubsub support, on the project page you can see an example to publish/subscribe to a pubsub topic, i use it in this project

Good luck.

Thanks, this seems to be the best solution for my, because I have got a fully async execution structure. On a short view your lib supports the default ipfs functionality and the pub/sub structure. This is great

Thanks a lot

Hi! Main dev of *py-ipfs-api` here!

PubSub is actually supported in py-ipfs-api (and the new py-ipfs-http-client), but I apparently forgot to update the documentation for 0.4.3, so you can’t see it as part of the documentation atm. The integration test should be pretty easy to understand though.

There is also a dormant branch with async-support (based on aiohttp), but it has some issues when not enabling async so I never attempted to merge it into the main project. Is this something that would be of use to you (or anybody else here)?

Sincerely,
Alexander