�
���gt � �l � d dl Z d dlZd dlZ d dlZn
# e$ r dZY nw xY wddlmZ G d� de� � ZdS )� N� )�
PubSubManagerc �^ � � e Zd ZdZdZ d� fd� Z� fd�Zd � Zd
� Zd� Z d� Z
d
� Zd� Z� xZ
S )�KombuManagera Client manager that uses kombu for inter-process messaging.
This class implements a client manager backend for event sharing across
multiple processes, using RabbitMQ, Redis or any other messaging mechanism
supported by `kombu <http://kombu.readthedocs.org/en/latest/>`_.
To use a kombu backend, initialize the :class:`Server` instance as
follows::
url = 'amqp://user:password@hostname:port//'
server = socketio.Server(client_manager=socketio.KombuManager(url))
:param url: The connection URL for the backend messaging queue. Example
connection URLs are ``'amqp://guest:guest@localhost:5672//'``
and ``'redis://localhost:6379/'`` for RabbitMQ and Redis
respectively. Consult the `kombu documentation
<http://kombu.readthedocs.org/en/latest/userguide /connections.html#urls>`_ for more on how to construct
connection URLs.
:param channel: The channel name on which the server sends and receives
notifications. Must be the same in all the servers.
:param write_only: If set to ``True``, only initialize to emit events. The
default of ``False`` initializes the class for emitting
and receiving.
:param connection_options: additional keyword arguments to be passed to
``kombu.Connection()``.
:param exchange_options: additional keyword arguments to be passed to
``kombu.Exchange()``.
:param queue_options: additional keyword arguments to be passed to
``kombu.Queue()``.
:param producer_options: additional keyword arguments to be passed to
``kombu.Producer()``.
�kombu�#amqp://guest:guest@localhost:5672//�socketioFNc � �� t �t d� � �t � � � |||�� � || _ |pi | _ |pi | _ |pi | _ |pi | _ | � � � | _
d S )NzLKombu package is not installed (Run "pip install kombu" in your virtualenv).)�channel�
write_only�logger)r �RuntimeError�super�__init__�url�connection_options�exchange_options�
queue_options�producer_options�_connection�publisher_connection)
�selfr r r r
r r r r � __class__s
��f/home/asafur/pinokio/api/open-webui.git/app/env/lib/python3.11/site-packages/socketio/kombu_manager.pyr zKombuManager.__init__1 s� �� � �=�� .� /� /�
/� ������Z���O�O�O����"4�":���� 0� 6�B���*�0�b��� 0� 6�B���$(�$4�$4�$6�$6��!�!�!� c �
�� t � � � � � d}| j j dk rddlm} |d� � }nd| j j v rddlm} |d� � }|st d| j j z � � �d S ) NT�eventletr )�is_monkey_patched�socket�gevent)�is_module_patchedz<Kombu requires a monkey patched socket library to work with ) r �
initialize�server�
async_mode�eventlet.patcherr �
gevent.monkeyr! r )r �monkey_patchedr r! r s �r r"