- Home Page
- API Documentation
- Pubsub Recipes
Enter search terms or a module, class or function name.
An application that wishes to make use of pubsub’s main functionality should import pubsub’s pub module:
from pubsub import pub
The pub module supports:
the signature of functions of pub module, as seen in this manual, typically have self as first function parameter. Omit this parameter in your calls, as it is provided for you by Python (so it will not be described in the text). For instance for pub.subscribe the signature is subscribe(self, listener, topicName), but it must be called as though it were subscribe(listener, topicName).
“Publishing” and “Sending a message to the rest of your application” are the same thing in this documentation.
To publish a message, it is sufficient to use the pub.sendMessage() function:
Send a message.
For example, to send a message of topic ‘topicA’ with two data items, arg1 and arg2:
pub.sendMessage('topicA', arg1=123, arg2='abc')
For the task of publishing messages, here are some important concepts:
More details can be found on the following pages: