From 1d37649fbdcfd15b98cadc524580f6d4d8d80bb6 Mon Sep 17 00:00:00 2001 From: Miguel Grinberg Date: Sun, 16 Jul 2017 08:34:47 -0700 Subject: [PATCH] also add ignore_queue to send function --- flask_socketio/__init__.py | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/flask_socketio/__init__.py b/flask_socketio/__init__.py index 04530f27..989bf162 100644 --- a/flask_socketio/__init__.py +++ b/flask_socketio/__init__.py @@ -658,6 +658,13 @@ def handle_my_custom_event(json): :param include_self: ``True`` to include the sender when broadcasting or addressing a room, or ``False`` to send to everyone but the sender. + :param ignore_queue: Only used when a message queue is configured. If + set to ``True``, the event is emitted to the + clients directly, without going through the queue. + This is more efficient, but only works when a + single server process is used, or when there is a + single addresee. It is recommended to always leave + this parameter with its default value of ``False``. """ if 'namespace' in kwargs: namespace = kwargs['namespace'] @@ -698,6 +705,13 @@ def send(message, **kwargs): :param include_self: ``True`` to include the sender when broadcasting or addressing a room, or ``False`` to send to everyone but the sender. + :param ignore_queue: Only used when a message queue is configured. If + set to ``True``, the event is emitted to the + clients directly, without going through the queue. + This is more efficient, but only works when a + single server process is used, or when there is a + single addresee. It is recommended to always leave + this parameter with its default value of ``False``. """ if 'namespace' in kwargs: namespace = kwargs['namespace'] @@ -709,10 +723,12 @@ def send(message, **kwargs): if room is None and not broadcast: room = flask.request.sid include_self = kwargs.get('include_self', True) + ignore_queue = kwargs.get('ignore_queue', False) socketio = flask.current_app.extensions['socketio'] return socketio.send(message, namespace=namespace, room=room, - include_self=include_self, callback=callback) + include_self=include_self, callback=callback, + ignore_queue=ignore_queue) def join_room(room, sid=None, namespace=None):