Connect easily to a spacebro server
Project description
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
Connect
from pySpacebroClient import SpacebroClient
settings = {
'host': 'spacebro.space',
'port': 3333,
'client': {
'name': 'python-bro'
},
'channelName': 'mychannelname'
}
spacebroClient = SpacebroClient(settings)
spacebroClient.wait()
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()
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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
pySpacebroClient-0.0.1.tar.gz
(4.0 kB
view hashes)
Built Distribution
Close
Hashes for pySpacebroClient-0.0.1-py2-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2d62173997b87d5a054f18e872f78f9778ff8f51ab0587c2e04b448b3a6bbeda |
|
MD5 | 78eb3e0dec246c9b6fdd7815a876860e |
|
BLAKE2b-256 | 0f9e5bd969d43cf625e0b13db6290be869daf9674c74937f542776a09250efde |