Skip to main content

pySpacebroClient

🌟 Connect easily to a [spacebro server](https://github.com/spacebro/spacebro).

a port of nodejs spacebro-client

Why

No more custom socket.io server.

Easily connect with socket.io to other clients.

Spacebro offers an API to connect clients input and output together.

Installation

pip install pySpacebroClient

Usage

  1. Connect

from pySpacebroClient import SpacebroClient

settings = {
    'host': 'spacebro.space',
    'port': 3333,
    'client': {
        'name': 'python-bro'
    },
    'channelName': 'mychannelname'
}
spacebroClient = SpacebroClient(settings)
spacebroClient.wait()
  1. Emit a message for an app called node-bro

from pySpacebroClient import SpacebroClient

settings = {
    'host': 'spacebro.space',
    'port': 3333,
    'client': {
        'name': 'python-bro'
    },
    'channelName': 'mychannelname',
    'out': {
        'outMedia': {
            'eventName': 'outMedia',
            'description': 'Output media',
            'type': 'all'
        }
    },
    'connection': 'python-bro/outMedia => node-bro/inMedia'
}
spacebroClient = SpacebroClient(settings)
spacebroClient.emit(settings.out.outMedia.eventName, {'value': 5})
spacebroClient.wait()
  1. Receive a message from an app called chokibro

from pySpacebroClient import SpacebroClient

def on_inMedia(self, args):
    print('received', args)

settings = {
    'host': 'spacebro.space',
    'port': 3333,
    'client': {
        'name': 'python-bro'
    },
    'channelName': 'mychannelname',
    'in': {
        'inMedia': {
            'eventName': 'inMedia',
            'description': 'Input media',
            'type': 'all'
        }
    },
    'connection': 'chokibro/outMedia => python-bro/inMedia'
}
spacebroClient = SpacebroClient(settings)
spacebroClient.on(settings['in'].inMedia.eventName, self.on_inMedia)
spacebroClient.wait()

test command

python -m tests.test

Metadata

Release files for pySpacebroClient 0.0.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pySpacebroClient 0.0.3
File Size Uploaded
pySpacebroClient-0.0.3.tar.gz 4.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pySpacebroClient 0.0.3
File Interpreter ABI Platform
pySpacebroClient-0.0.3-py2-none-any.whl Python 2 none any Details

Total release size: 8.7 kB

Release files / pySpacebroClient-0.0.3.tar.gz

Download URL pySpacebroClient-0.0.3.tar.gz
Size 4.0 kB
Tags Source
SHA-256 checksum
How to use checksums
50043a7100a590619cb2b45b4116060fae78cb9e1cb683437e8b73ff6dbf7197
BLAKE2b-256 checksum
How to use checksums
0bd8c5a025aa68e0e1f561c132ded699208ac1e2ac748d3385663664dc0b38e3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / pySpacebroClient-0.0.3-py2-none-any.whl

Download URL pySpacebroClient-0.0.3-py2-none-any.whl
Size 4.7 kB
Tags Python 2
SHA-256 checksum
How to use checksums
2cc79a373973971be06ba652e784948fb44e05d1d83ef34fc7d2f4cad0f95cf3
BLAKE2b-256 checksum
How to use checksums
9f3b9eab0c8d3b6c7d4a1297118cfc5fcd98fe94068d213db16f3ae2df2f1a36
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.0.3 This release

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page