§
    !ß·i�)  ã                   ót   — d dl Z d dlZddlmZ ddlmZ ddlmZ  e j        d¦  «        Z G d„ d¦  «        ZdS )	é    Né   )Úmanager)Úbase_namespace)Úpacketzsocketio.serverc                   ó’   — e Zd ZddgZej        j        Z	 	 	 dd„Zd„ Zdd	„Z	d
„ Z
d„ Zdd„Zdd„Zdd„Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ ZdS )Ú
BaseServerÚconnectÚ
disconnectNFÚdefaultTc                 ó~  — |}	|	                      dd ¦  «        }
|
�|
|	d<   |dk    rt          j        | _        n |dk    rddlm} |j        | _        n|| _        |�|| j        _        ||	d<   d|	d	<    |                      ¦   «         di |	¤Ž| _	        | j	         
                    d
| j        ¦  «         | j	         
                    d| j        ¦  «         | j	         
                    d| j        ¦  «         i | _        i | _        i | _        t#          ¦   «         | _        i | _        t)          |t*          ¦  «        s|| _        nœt.          | _        | j        j        t2          j        k    rv|r%| j                             t2          j        ¦  «         n$| j                             t2          j        ¦  «         | j                             t3          j        ¦   «         ¦  «         |€tA          j!        ¦   «         }|| _         | j          "                    | ¦  «         d| _#        || _$        || _%        |pdg| _&        | j	        j'        | _'        d S )NÚengineio_loggerÚloggerr   Úmsgpackr   )Úmsgpack_packetÚjsonFÚasync_handlersr	   Úmessager
   ú/© )(Úpopr   ÚPacketÚpacket_classÚ r   ÚMsgPackPacketr   Ú_engineio_server_classÚeioÚonÚ_handle_eio_connectÚ_handle_eio_messageÚ_handle_eio_disconnectÚenvironÚhandlersÚnamespace_handlersÚobjectÚnot_handledÚ_binary_packetÚ
isinstanceÚboolr   Údefault_loggerÚlevelÚloggingÚNOTSETÚsetLevelÚINFOÚERRORÚ
addHandlerÚStreamHandlerr   ÚManagerÚ
set_serverÚmanager_initializedr   Úalways_connectÚ
namespacesÚ
async_mode)ÚselfÚclient_managerr   Ú
serializerr   r   r5   r6   ÚkwargsÚengineio_optionsr   r   s               úY/home/mmwave/public_html/mmwave/venv/lib/python3.11/site-packages/socketio/base_server.pyÚ__init__zBaseServer.__init__   s2  € ð "ÐØ*×.Ò.Ð/@À$ÑGÔGˆØÐ&Ø)8Ð˜XÑ&Ø˜Ò"Ð"Ý &¤ˆDÔÐØ˜9Ò$Ð$Ø(Ð(Ð(Ð(Ð(Ð(Ø .Ô <ˆDÔÐà *ˆDÔØÐØ%)ˆDÔÔ"Ø'+Ð˜VÑ$Ø-2ÐÐ)Ñ*Ø0�4×.Ò.Ñ0Ô0ÐDÐDÐ3CÐDÐDˆŒØŒ�Š�I˜tÔ7Ñ8Ô8Ð8ØŒ�Š�I˜tÔ7Ñ8Ô8Ð8ØŒ�Š�L $Ô"=Ñ>Ô>Ð>àˆŒØˆŒØ"$ˆÔÝ!™8œ8ˆÔà ˆÔå˜&¥$Ñ'Ô'ð 		@Ø ˆDŒKˆKå(ˆDŒKØŒ{Ô ¥G¤NÒ2Ð2Øð 8Ø”K×(Ò(­¬Ñ6Ô6Ð6Ð6à”K×(Ò(­¬Ñ7Ô7Ð7Ø”×&Ò&¥wÔ'<Ñ'>Ô'>Ñ?Ô?Ð?àÐ!Ý$œ_Ñ.Ô.ˆNØ%ˆŒØŒ×Ò Ñ%Ô%Ð%Ø#(ˆÔ à,ˆÔØ,ˆÔØ$Ð-¨¨ˆŒàœ(Ô-ˆŒˆˆó    c                 ó   — dS )NFr   ©r8   s    r=   Úis_asyncio_basedzBaseServer.is_asyncio_basedE   s   € Øˆur?   c                 ó@   ‡ ‡‡— ‰pdŠˆˆˆ fd„}|€|S  ||¦  «         dS )aã	  Register an event handler.

        :param event: The event name. It can be any string. The event names
                      ``'connect'``, ``'message'`` and ``'disconnect'`` are
                      reserved and should not be used. The ``'*'`` event name
                      can be used to define a catch-all event handler.
        :param handler: The function that should be invoked to handle the
                        event. When this parameter is not given, the method
                        acts as a decorator for the handler function.
        :param namespace: The Socket.IO namespace for the event. If this
                          argument is omitted the handler is associated with
                          the default namespace. A catch-all namespace can be
                          defined by passing ``'*'`` as the namespace.

        Example usage::

            # as a decorator:
            @sio.on('connect', namespace='/chat')
            def connect_handler(sid, environ):
                print('Connection request')
                if environ['REMOTE_ADDR'] in blacklisted:
                    return False  # reject

            # as a method:
            def message_handler(sid, msg):
                print('Received message: ', msg)
                sio.send(sid, 'response')
            socket_io.on('message', namespace='/chat', handler=message_handler)

        The arguments passed to the handler function depend on the event type:

        - The ``'connect'`` event handler receives the ``sid`` (session ID) for
          the client and the WSGI environment dictionary as arguments.
        - The ``'disconnect'`` handler receives the ``sid`` for the client as
          only argument.
        - The ``'message'`` handler and handlers for custom event names receive
          the ``sid`` for the client and the message payload as arguments. Any
          values returned from a message handler will be passed to the client's
          acknowledgement callback function if it exists.
        - A catch-all event handler receives the event name as first argument,
          followed by any arguments specific to the event.
        - A catch-all namespace event handler receives the namespace as first
          argument, followed by any arguments specific to the event.
        - A combined catch-all namespace and catch-all event handler receives
          the event name as first argument and the namespace as second
          argument, followed by any arguments specific to the event.
        r   c                 óN   •— ‰‰j         vr
i ‰j         ‰<   | ‰j         ‰         ‰<   | S ©N)r"   )ÚhandlerÚeventÚ	namespacer8   s    €€€r=   Úset_handlerz"BaseServer.on.<locals>.set_handlerz   s2   ø€ Ø ¤Ð-Ð-Ø+-�”˜iÑ(Ø.5ˆDŒM˜)Ô$ UÑ+ØˆNr?   Nr   )r8   rG   rF   rH   rI   s   `` ` r=   r   zBaseServer.onH   sX   øøø€ ð` Ð$ ˆ	ð	ð 	ð 	ð 	ð 	ð 	ð 	ð ˆ?ØÐØˆ�GÑÔÐÐÐr?   c                 óî   ‡ ‡‡— t          ‰¦  «        dk    rWt          ‰¦  «        dk    rDt          ‰d         ¦  «        r/ ‰                      ‰d         j        ¦  «        ‰d         ¦  «        S ˆˆˆ fd„}|S )a�  Decorator to register an event handler.

        This is a simplified version of the ``on()`` method that takes the
        event name from the decorated function.

        Example usage::

            @sio.event
            def my_event(data):
                print('Received data: ', data)

        The above example is equivalent to::

            @sio.on('my_event')
            def my_event(data):
                print('Received data: ', data)

        A custom namespace can be given as an argument to the decorator::

            @sio.event(namespace='/test')
            def my_event(data):
                print('Received data: ', data)
        r   r   c                 óB   •—   ‰j         | j        g‰¢R i ‰¤Ž| ¦  «        S rE   )r   Ú__name__)rF   Úargsr;   r8   s    €€€r=   rI   z%BaseServer.event.<locals>.set_handler¢   s2   ø€ ØA�w�t”w˜wÔ/ÐA°$ÐAÐAÐA¸&ÐAÐAÀ'ÑJÔJÐJr?   )ÚlenÚcallabler   rL   )r8   rM   r;   rI   s   ``` r=   rG   zBaseServer.event„   s’   øøø€ õ0 ˆt‰9Œ9˜Š>ˆ>�c &™kœk¨QÒ.Ð.µ8¸DÀ¼GÑ3DÔ3DÐ.ð -�4—7’7˜4 œ7Ô+Ñ,Ô,¨T°!¬WÑ5Ô5Ð5ðKð Kð Kð Kð Kð Kð Kð Ðr?   c                 ó  — t          |t          j        ¦  «        st          d¦  «        ‚|                      ¦   «         |                     ¦   «         k    rt          d¦  «        ‚|                     | ¦  «         || j        |j        <   dS )zõRegister a namespace handler object.

        :param namespace_handler: An instance of a :class:`Namespace`
                                  subclass that handles all the event traffic
                                  for a namespace.
        zNot a namespace instancez+Not a valid namespace class for this serverN)r'   r   ÚBaseServerNamespaceÚ
ValueErrorrB   Ú_set_serverr#   rH   )r8   Únamespace_handlers     r=   Úregister_namespacezBaseServer.register_namespace§   s�   € õ Ð+Ý(Ô<ñ>ô >ð 	9åÐ7Ñ8Ô8Ð8Ø× Ò Ñ"Ô"Ð&7×&HÒ&HÑ&JÔ&JÒJÐJÝÐJÑKÔKÐKØ×%Ò% dÑ+Ô+Ð+àð 	ÔÐ 1Ô ;Ñ<Ð<Ð<r?   c                 ó@   — |pd}| j                              ||¦  «        S )zîReturn the rooms a client is in.

        :param sid: Session ID of the client.
        :param namespace: The Socket.IO namespace for the event. If this
                          argument is omitted the default namespace is used.
        r   )r   Ú	get_rooms)r8   ÚsidrH   s      r=   ÚroomszBaseServer.rooms·   s&   € ð Ð$ ˆ	ØŒ|×%Ò% c¨9Ñ5Ô5Ð5r?   c                 óp   — | j                              ||pd¦  «        }| j                             |¦  «        S )a_  Return the name of the transport used by the client.

        The two possible values returned by this function are ``'polling'``
        and ``'websocket'``.

        :param sid: The session of the client.
        :param namespace: The Socket.IO namespace. If this argument is omitted
                          the default namespace is used.
        r   )r   Úeio_sid_from_sidr   Ú	transport©r8   rX   rH   Úeio_sids       r=   r\   zBaseServer.transportÁ   s6   € ð ”,×/Ò/°°YÐ5EÀ#ÑFÔFˆØŒx×!Ò! 'Ñ*Ô*Ð*r?   c                 óp   — | j                              ||pd¦  «        }| j                             |¦  «        S )zñReturn the WSGI environ dictionary for a client.

        :param sid: The session of the client.
        :param namespace: The Socket.IO namespace. If this argument is omitted
                          the default namespace is used.
        r   )r   r[   r!   Úgetr]   s       r=   Úget_environzBaseServer.get_environÎ   s6   € ð ”,×/Ò/°°YÐ5EÀ#ÑFÔFˆØŒ|×Ò Ñ(Ô(Ð(r?   c                 ó”  — d }|| j         v rT|| j         |         v r| j         |         |         }n1|| j        vr(d| j         |         v r| j         |         d         }|g|¢R }|€dd| j         v r[|| j         d         v r| j         d         |         }|g|¢R }n2|| j        vr)d| j         d         v r| j         d         d         }||g|¢R }||fS ©NÚ*)r"   Úreserved_events)r8   rG   rH   rM   rF   s        r=   Ú_get_event_handlerzBaseServer._get_event_handlerØ   s  € ð ˆØ˜œÐ%Ð%Ø˜œ iÔ0Ð0Ð0Øœ-¨	Ô2°5Ô9��Ø˜dÔ2Ð2Ð2Ø˜4œ=¨Ô3Ð3Ð3Øœ-¨	Ô2°3Ô7�Ø�~ �~�~�Øˆ?˜s d¤mÐ3Ð3Ø˜œ cÔ*Ð*Ð*Øœ-¨Ô,¨UÔ3�Ø!Ð) DÐ)Ð)��Ø˜dÔ2Ð2Ð2Ø˜4œ=¨Ô-Ð-Ð-Øœ-¨Ô,¨SÔ1�Ø˜yÐ0¨4Ð0Ð0�Ø˜ˆ}Ðr?   c                 óv   — d }|| j         v r| j         |         }|€d| j         v r| j         d         }|g|¢R }||fS rc   )r#   )r8   rH   rM   rF   s       r=   Ú_get_namespace_handlerz!BaseServer._get_namespace_handlerò   s]   € ð ˆØ˜Ô/Ð/Ð/ØÔ-¨iÔ8ˆGØˆ?˜s dÔ&=Ð=Ð=ØÔ-¨cÔ2ˆGØÐ% Ð%Ð%ˆDØ˜ˆ}Ðr?   c                 ó   — t          ¦   «         ‚rE   ©ÚNotImplementedErrorrA   s    r=   r   zBaseServer._handle_eio_connect   ó   € Ý!Ñ#Ô#Ð#r?   c                 ó   — t          ¦   «         ‚rE   rj   )r8   Údatas     r=   r   zBaseServer._handle_eio_message  rl   r?   c                 ó   — t          ¦   «         ‚rE   rj   rA   s    r=   r    z!BaseServer._handle_eio_disconnect  rl   r?   c                 ó    — t          d¦  «        ‚)Nz!Must be implemented in subclassesrj   rA   s    r=   r   z!BaseServer._engineio_server_class	  s   € Ý!Ð"EÑFÔFÐFr?   )NFr   NTFN)NNrE   )rL   Ú
__module__Ú__qualname__re   ÚengineioÚServerÚreasonr>   rB   r   rG   rU   rY   r\   ra   rf   rh   r   r   r    r   r   r?   r=   r   r      s$  € € € € € Ø  ,Ð/€OØŒ_Ô#€FàENØ@EØ ð3.ð 3.ð 3.ð 3.ðjð ð ð:ð :ð :ð :ðx!ð !ð !ðFð ð ð 6ð 6ð 6ð 6ð+ð +ð +ð +ð)ð )ð )ð )ðð ð ð4ð ð ð$ð $ð $ð$ð $ð $ð$ð $ð $ðGð Gð Gð Gð Gr?   r   )	r+   rs   r   r   r   r   Ú	getLoggerr)   r   r   r?   r=   ú<module>rw      s¦   ðØ €€€à €€€à Ð Ð Ð Ð Ð Ø Ð Ð Ð Ð Ð Ø Ð Ð Ð Ð Ð à"�Ô"Ð#4Ñ5Ô5€ð~Gð ~Gð ~Gð ~Gð ~Gñ ~Gô ~Gð ~Gð ~Gð ~Gr?   