Skip to main content

Pubsub client for python, since ipfshttpclient pubsub isn't compatibe with the newer versions of ipfs

Project description

py-ipfs-pubsub

Pubsub client for python, since ipfshttpclient pubsub isn't compatibe with the newer versions of ipfs. Using openpubsub.com

http://github.com/ZachisGit/py-ipfs-pubsub

Install

pip3 install py-ipfs-pubsub

Example

import pubsub


# Topic specific callback
def on_sub_test(data,seqno,topic_ids,cid):

	print ("New Message:",cid)
	print (data)
	print ("")


# Subscribe - pubsub.sub(endpoint, topic, callback)
pubsub.sub("/dns/nodes.openpubsub.com/tcp/5001/http","mytopic",on_sub_test)

# Publish 10x
for i in range(10):
	# Publish - pubsub.pub(endpoint, topic, str/bytes message)
	pubsub.pub("/dns/nodes.openpubsub.com/tcp/5001/http","mytopic","Hello World!")
	input("")

# Unsubscribe from topic - pubsub.unsub(topic)
pubsub.unsub("mytopic")

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

openpubsub-0.0.2.tar.gz (2.3 kB view details)

Uploaded Source

File details

Details for the file openpubsub-0.0.2.tar.gz.

File metadata

  • Download URL: openpubsub-0.0.2.tar.gz
  • Upload date:
  • Size: 2.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.6

File hashes

Hashes for openpubsub-0.0.2.tar.gz
Algorithm Hash digest
SHA256 3455b7b200998edf365a25774c24faf85c822fb6d6d8700107698bc65480c200
MD5 c5d5c9f79baf2f3f3368c90c3eed7c61
BLAKE2b-256 2116354414e44dfc39668a954e02cc549ca8774b6921655cec5003b08be5041a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page