@@ -233,10 +233,11 @@ type of installation, each server processes owns the connections to a subset
233233of the clients. To make broadcasting work in this environment, the servers
234234communicate with each other through the message queue.
235235
236- The message queue service needs to be installed and configured separately. By
237- default, the server uses `Kombu <http://kombu.readthedocs.org/en/latest/ >`_
238- to access the message queue, so any message queue supported by this package
239- can be used. Kombu can be installed with pip::
236+ The message queue service needs to be installed and configured separately. One
237+ of the options offered by this package is to use
238+ `Kombu <http://kombu.readthedocs.org/en/latest/ >`_ to access the message
239+ queue, which means that any message queue supported by this package can be
240+ used. Kombu can be installed with pip::
240241
241242 pip install kombu
242243
@@ -252,29 +253,40 @@ To configure a Socket.IO server to connect to a message queue, the
252253following example instructs the server to connect to a Redis service running
253254on the same host and on the default port::
254255
255- redis = socketio.KombuManager('redis://')
256- sio = socketio.Server(client_manager=redis )
256+ mgr = socketio.KombuManager('redis://')
257+ sio = socketio.Server(client_manager=mgr )
257258
258259For a RabbitMQ queue also running on the local server with default
259260credentials, the configuration is as follows::
260261
261- amqp = socketio.KombuManager('amqp://')
262- sio = socketio.Server(client_manager=amqp )
262+ mgr = socketio.KombuManager('amqp://')
263+ sio = socketio.Server(client_manager=mgr )
263264
264- The arguments passed to the ``KombuManager `` constructor are passed directly
265- to Kombu's `Connection object
265+ The URL passed to the ``KombuManager `` constructor is passed directly to
266+ Kombu's `Connection object
266267<http://kombu.readthedocs.org/en/latest/userguide/connections.html> `_, so
267268the Kombu documentation should be consulted for information on how to
268269connect to the message queue appropriately.
269270
271+ If the use of Kombu is not desired, native Redis support is also offered
272+ through the ``RedisManager `` class. This class takes the same arguments as
273+ ``KombuManager ``, but connects directly to a Redis store using the queue's
274+ pub/sub functionality::
275+
276+
277+ mgr = socketio.RedisManager('redis://')
278+ sio = socketio.Server(client_manager=mgr)
279+
270280If multiple Sokcet.IO servers are connected to a message queue, they
271281automatically communicate with each other and manage a combined client list,
272282without any need for additional configuration. To have a process other than
273- the server connect to the queue to emit a message, the same ``KombuManager ``
274- class can be used as standalone object. For example::
283+ a server connect to the queue to emit a message, the same ``KombuManager ``
284+ and ``RedisManager `` classes can be used as standalone object. In this case,
285+ the ``write_only `` argument should be set to ``True `` to disable the creation
286+ of a listening thread. For example::
275287
276- # connect to the redis queue
277- redis = socketio.KombuManager('redis://localhost:6379/' )
288+ # connect to the redis queue through Kombu
289+ redis = socketio.KombuManager('redis://', write_only=True )
278290
279291 # emit an event
280292 redis.emit('my event', data={'foo': 'bar'}, room='my room')
0 commit comments