PubSubClient
Session-scoped facade over PubSubHub.
This client binds all pub/sub operations to one session ID so callers can publish and subscribe without passing their session identity explicitly on each call.
Methods
-
send_all–Broadcasts a global message to all sessions.
-
send_all_on_topic–Broadcasts a topic message to all subscribers of
topic. -
send_others–Broadcasts a global message to all sessions except this client session.
-
send_others_on_topic–Broadcasts a topic message excluding this client session.
-
subscribe–Subscribes this session to global messages.
-
subscribe_topic–Subscribes this session to a topic.
-
unsubscribe–Removes global subscriptions for this session.
-
unsubscribe_all–Removes all global and topic subscriptions for this session.
-
unsubscribe_topic–Removes this session's subscriptions for a specific topic.
Methods#
send_all_on_topic
#
send_others
#
send_others(message: Any)
Broadcasts a global message to all sessions except this client session.
Parameters:
-
message(Any) –Payload to publish.
send_others_on_topic
#
subscribe
#
subscribe(handler: Callable)
Subscribes this session to global messages.
The handler is invoked with one positional argument: message.
Parameters:
-
handler(Callable) –Sync or async callback for global messages.