Skip to main content

A publish-subscribe messaging system

Project description

pubsubx

pubsubx is a lightweight publish-subscribe messaging system implemented in Python. It provides a simple server and client for building distributed messaging applications.

Installation

You can install pubsubx using pip:

pip install pubsubx

Usage

Starting the server

To start the pubsubx server:

from pubsubx import PubSubServer

server = PubSubServer()
server.start()

Using the client

Here's a simple example of how to use the pubsubx client:

from pubsubx import PubSubClient
import time

def on_message(topic, message):
    print(f"Received message on topic '{topic}': {message}")

# Create and connect the client
client = PubSubClient()
client.connect()

# Set up the message callback
client.on_message(on_message)

# Subscribe to a topic
client.subscribe("test_topic")

# Publish a message
client.publish("test_topic", "Hello, pubsubx!")

# Keep the script running
try:
    while True:
        time.sleep(1)
except KeyboardInterrupt:
    print("Disconnecting...")
    client.disconnect()

License

This project is licensed under the MIT License.

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

pubsubx-0.1.1.tar.gz (3.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pubsubx-0.1.1-py3-none-any.whl (4.0 kB view details)

Uploaded Python 3

File details

Details for the file pubsubx-0.1.1.tar.gz.

File metadata

  • Download URL: pubsubx-0.1.1.tar.gz
  • Upload date:
  • Size: 3.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.4

File hashes

Hashes for pubsubx-0.1.1.tar.gz
Algorithm Hash digest
SHA256 b2ca6f6c8d505de2feb33b11e9ffce5c6777d6b875655afb8d4da94b7b0e5071
MD5 5f4aa642fcb1faf7ded730a0e17bcb6d
BLAKE2b-256 c87f58587d3637a7328c877186f1d75ccfdd352471b4d5ac54168f78390a5791

See more details on using hashes here.

File details

Details for the file pubsubx-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: pubsubx-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 4.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.4

File hashes

Hashes for pubsubx-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 a1be7fa68bea98e0a76b60e887b7063dd1608179d44f14487476eccc3fe51fa5
MD5 7db867146621f62e0827bcdffbcd0aa4
BLAKE2b-256 dff88cff973bd1d0cbf3b3f9c9933da13ac8a35554d34a96a1d1fbdf25424184

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