Skip to main content

Chatterbox Bus Client

This module is a simple interface for the chatterbox messagebus and can be used to connect to chatterbox, send messages and react to messages sent by the Chatterbox system.

MessageBusClient()

The MessageBusClient() If no arguments are provided it will try to connect to a local instance of chatterbox core on the default endpoint and port.

Message()

The Message object is a representation of the messagebus message, this will always contain a message type but can also contain data and context. Data is usually real information while the context typically contain information on where the message originated or who the intended recipient is.

Message('MESSAGE_TYPE', data={'meaning': 42}, context={'origin': 'A.Dent'})

AES encryption is supported by setting a key in /etc/chatterbox/bus.conf

Examples

Below are some a couple of simple cases for sending a message on the bus as well as reacting to messages on the bus

Sending a message on the bus.

from chatterbox_bus_client import MessageBusClient, Message

print('Setting up client to connect to a local chatterbox instance')
client = MessageBusClient()
client.run_in_thread()

print('Sending speak message...')
client.emit(Message('speak', data={'utterance': 'Hello World'}))

Catching a message on the messagebus

from chatterbox_bus_client import MessageBusClient, Message

print('Setting up client to connect to a local chatterbox instance')
client = MessageBusClient()


def print_utterance(message):
    print('Mycroft said "{}"'.format(message.data.get('utterance')))


print('Registering handler for speak message...')
client.on('speak', print_utterance)

client.run_forever()

Metadata

Release files for chatterbox-bus-client 0.0.11

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

Source distribution (sdist)

Source distribution for chatterbox-bus-client 0.0.11
File Size Uploaded
chatterbox_bus_client-0.0.11.tar.gz 14.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for chatterbox-bus-client 0.0.11
File Interpreter ABI Platform
chatterbox_bus_client-0.0.11-py3-none-any.whl Python 3 none any Details

Total release size: 30.5 kB

Release files / chatterbox_bus_client-0.0.11.tar.gz

Download URL chatterbox_bus_client-0.0.11.tar.gz
Size 14.4 kB
Tags Source
SHA-256 checksum
How to use checksums
758b2e0c3d099de04c9591128edddf77ccc4fc4528fd56332f2b3cbb3375c14f
BLAKE2b-256 checksum
How to use checksums
40c8b546e4a6959ec74a9fced13e47c1a582a15c0b1cd17ab76d35bee1b26f48
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.9.6

Release files / chatterbox_bus_client-0.0.11-py3-none-any.whl

Download URL chatterbox_bus_client-0.0.11-py3-none-any.whl
Size 16.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a453c7d0b2b28a048f48cd35be71097a62eb86036259d21f364382b296569c4d
BLAKE2b-256 checksum
How to use checksums
b3dbcdcf8686e1685f36df0d06d9b0864e4cffac7e4efd15b689ed5c7fe1e79b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.9.6

Release history Release notifications | RSS feed

This release

0.0.11 This release

2 release files

0.0.10

1 release file

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