Skip to main content

A Dead Simple Python Subscriber/Publisher Network

Project description

Mini Observer Network

####Painfully Simple Subscriber Publisher network. Default encoding is JSON, optional encoding for raw bytes

###1. Start the server use the -port #### -length # -encode (option) as arguments

1.-length # is the size of the header for length of the message

2.-encode (type) JSON or bytes

###2. Create Nodes in your code. tnode = miniOJN.Node(server_ip_str, port_number) ###3. Subscribe to topics tnode.subscribe("generic topic name") ###4. Use the Nodes to read from topics and publish to them

publish to a topic

tnode.publish("generic topic name", "hello world")

check out many items are waiting to be read

tnode.status()

read the items

topic, info = tnode.read()

At the moment

Only supported encoding are JSON and bytes. The message length header is variable. These numbers and encodings must be consistent throughout the network.

Q&A

The topics do not record history (Once a message is read it pops off the queue AND nodes don't get messages from before connection.)

The Nodes are anonymous (they don't have verified names)

Nodes will receive things they publish if they are subscribed to them.

There is no encryption (yet), It hurts being able to port miniOJN to other languages. (but will be added as an option)

####the packets are easy to decode for other languages, mostly.

Every packet starts with N(4) digits that represent it's length. so a message cannot be over 10kb (by default) The Packets are JSON or bytes after that. The word SUBSCRIBE as a string is used for subscribing to topics by a node.

That's it folks

Name server (optional utility)

I had a need for mobile and network config independent servers on a lan. To this end I decided on this extension.

  1. Start up the name_server.py on a known reliable address
  2. Start up your servers using the -name (server_name) and -ns (ip_for_name_server)
  3. use host, port = mobnet.Nameservice.lookup(name)
  4. connect your node to the host and port received

Project details


Release history Release notifications | RSS feed

This version

1.0

Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

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

mobnet-1.0-py3-none-any.whl (6.1 kB view details)

Uploaded Python 3

File details

Details for the file mobnet-1.0-py3-none-any.whl.

File metadata

  • Download URL: mobnet-1.0-py3-none-any.whl
  • Upload date:
  • Size: 6.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.3

File hashes

Hashes for mobnet-1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f064dd99cdf4d9b00fec4e4e09ff86638fa15e3908cab8445c477d49e07dc4b8
MD5 eb6ea53243e836e82fc8b6bbddbab78f
BLAKE2b-256 c8aa2cb48c2f7fd6a8f51e9808beda2fea411add016c385a2f5cef0381e828c4

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