Womack publisher

To publish events to clients, use a womack.publish.Publisher instance that is configured to connect to the same redis server as the socket server serving the clients. Then when you publish on a channel, clients who have subscribed to that channel will receive the message.

Reference

class womack.publish.Publisher(redis_connection=None, key=None)[source]

Womack event publisher.

Use instances of this class to publish events to Womack channels.

Parameters:
  • redis_connection – Redis instance to publish events to. Default is None, in which case a connection will be to the made to the redis_host and redis_port set in the Womack config.
  • key – The key prefix to use when qualifying channel names. Default is None, in which case they key used is the one set in the Womack config.

Contains code derived from juggernaut.py which is copyright 2012 Armin Ronacher.

publish(channels, data, **options)[source]

Publish data to one ore more channels.

Parameters:
  • channels – Channel or list of channels.
  • data – Data to publish. Must be json-encodable.
  • **options – Additional keys to set in the hash passed to redis.publish().

Project Versions

Table Of Contents

Previous topic

Womack client

Next topic

Womack server

This Page