� ���g���N�ddlZddlmZddlmZddlmZGd�de��ZdS)�N)�packet�)� BaseManagerc�T��eZdZdZd�Z d d�Z�fd�Zd�Zd d�Zd�Z d �Z d �Z �xZ S) � AsyncManagerz+Manage a client list for an asyncio server.c��2K�|�||��S�N)� is_connected)�self�sid� namespaces �f/home/asafur/pinokio/api/open-webui.git/app/env/lib/python3.11/site-packages/socketio/async_manager.py�can_disconnectzAsyncManager.can_disconnect s����� � ��i�0�0�0�Nc ���K�|p|}||jvrdSt|t��rt|��}n|�|g}ng}t|t��s|g}g} |s�|j�t j||g|z���} | ���} t| t��s| g} d�| D��} |� ||��D]N\} }| |vrE| D]B}| � tj |j� ||�������C�On�|� ||��D]�\} }| |vr�|�| |��}|j�t j||g|z|���} | � tj |j�|| ��������| gkrdStj| ���d{V��dS)z�Emit a message to a single client, a room, or all the clients connected to the namespace. Note: this method is a coroutine. N)r �datac�L�g|]!}tjtj|����"S�)� eio_packet�Packet�MESSAGE)�.0�ps r� <listcomp>z%AsyncManager.emit.<locals>.<listcomp>*s8��0�0�0��"�(��);�Q�?�?�0�0�0r)r r�id)�rooms� isinstance�tuple�list�server� packet_classr�EVENT�encode�get_participants�append�asyncio� create_task�_send_eio_packet�_generate_ack_id� _send_packet�wait)r �eventrr �room�skip_sid�callback�to�kwargs�tasks�pkt�encoded_packet�eio_pktr �eio_sidrrs r�emitzAsyncManager.emit sm�����z�T�� �D�J� &� &� �F� �d�E� "� "� ���:�:�D�D� � ��6�D�D��D��(�D�)�)� "� �z�H���� A��+�*�*�� � ���$��+�H�H�C� �Z�Z�\�\�N��n�d�3�3� 2�"0�!1��0�0� .�0�0�0�G� $� 5� 5�i�� F� F� G� G� ��W��h�&�&�$�G�G��� � �W�%8� �K�8�8��!�D�D�&F�&F�G�G�G�G�� G�!%� 5� 5�i�� F� F� A� A� ��W��h�&�&��.�.�s�H�=�=�B��+�2�2�� � ���$���3���C��L�L��!4�� �0�0��#�>�>�"@�"@�A�A�A�� �B�;�;� �F��l�5�!�!�!�!�!�!�!�!�!�!�!rc��L�K�t���||��S)z`Register a client connection to a namespace. Note: this method is a coroutine. )�super�connect)r r6r � __class__s �rr:zAsyncManager.connectBs!����� �w�w���w� �2�2�2rc��$K�|j||fi|��S)zHDisconnect a client. Note: this method is a coroutine. )�basic_disconnect)r r r r1s r� disconnectzAsyncManager.disconnectIs%���� %�t�$�S�)�>�>�v�>�>�>rc��8K�|�||||���S)zKAdd a client to a room. Note: this method is a coroutine. )r6)�basic_enter_room)r r r r-r6s r� enter_roomzAsyncManager.enter_roomPs%���� �$�$�S�)�T�7�$�K�K�Krc��4K�|�|||��S)zPRemove a client from a room. Note: this method is a coroutine. )�basic_leave_room)r r r r-s r� leave_roomzAsyncManager.leave_roomWs ���� �$�$�S�)�T�:�:�:rc��2K�|�||��S)zXRemove all participants from a room. Note: this method is a coroutine. )�basic_close_room)r r-r s r� close_roomzAsyncManager.close_room^s���� �$�$�T�9�5�5�5rc��>K�d} |j||}|j||=n7#t$r*|����d��YnwxYw|�:||�}t j|��r# |�d{V��dS#tj$rYdSwxYwdSdS)zSInvoke an application callback. Note: this method is a coroutine. Nz$Unknown callback received, ignoring.)� callbacks�KeyError� _get_logger�warningr&� iscoroutine�CancelledError)r r rrr/�rets r�trigger_callbackzAsyncManager.trigger_callbackes����� �� (��~�c�*�2�.�H� ��s�#�B�'�'�� � O� O� O� � � � � � &� &�'M� N� N� N� N� N� O���� � ��(�D�/�C��"�3�'�'� ���I�I�I�I�I�I�I�I�I���-�����D�D����� � � � s!�(�1A�A�;B�B�B)NNNNr ) �__name__� __module__� __qualname__�__doc__rr7r:r>rArDrGrP� __classcell__)r;s@rrrs��������5�5�1�1�1�FJ�%)�3"�3"�3"�3"�j3�3�3�3�3�?�?�?�L�L�L�L�;�;�;�6�6�6�������rr)r&�engineiorr�socketio� base_managerrrrrr�<module>rYs�������)�)�)�)�)�)�������%�%�%�%�%�%�p�p�p�p�p�;�p�p�p�p�pr
Memory