§
    !ß·i™-  ã                   óŽ   — d dl Z d dlZd dlZd dlZd dlZddlmZ ddlmZ  ej        d¦  «        Z	g Z
d„ Zda G d„ d¦  «        ZdS )	é    Né   )Úbase_namespace)Úpacketzsocketio.clientc                 óÊ   — t           dd…         D ]}|j                             ¦   «          Œt          t          ¦  «        rt	          | |¦  «        S t          j        | |¦  «        S )z•SIGINT handler.

    Notify any clients that are in a reconnect loop to abort. Other
    disconnection tasks are handled at the engine.io level.
    N)Úreconnecting_clientsÚ_reconnect_abortÚsetÚcallableÚoriginal_signal_handlerÚsignalÚdefault_int_handler)ÚsigÚframeÚclients      úY/home/mmwave/public_html/mmwave/venv/lib/python3.11/site-packages/socketio/base_client.pyÚsignal_handlerr      sj   € õ ' q q qÔ)ð &ð &ˆØÔ×#Ò#Ñ%Ô%Ð%Ð%ÝÕ'Ñ(Ô(ð 6Ý& s¨EÑ2Ô2Ð2õ Ô)¨#¨uÑ5Ô5Ð5ó    c                   ó�   — e Zd Zg d¢Zej        j        Z	 	 	 	 dd
„Zd„ Zdd„Z	d„ Z
d„ Zdd„Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd	S )Ú
BaseClient)ÚconnectÚconnect_errorÚ
disconnectÚ__disconnect_finalTr   r   é   ç      à?FÚdefaultNc
                 ó@  — |	rSt           €Lt          j        ¦   «         t          j        ¦   «         k    r$t	          j        t          j        t          ¦  «        a || _        || _        || _	        || _
        || _        |	| _        |
}|	|d<   |                     dd ¦  «        }|�||d<   |dk    rt          j        | _        n |dk    rddlm} |j        | _        n|| _        |�|| j        _        ||d<    |                      ¦   «         di |¤Ž| _        | j                             d	| j        ¦  «         | j                             d
| j        ¦  «         | j                             d| j        ¦  «         t7          |t8          ¦  «        s|| _        nœt<          | _        | j        j        t@          j!        k    rv|r%| j         "                    t@          j#        ¦  «         n$| j         "                    t@          j$        ¦  «         | j         %                    tA          j&        ¦   «         ¦  «         d | _'        d | _(        d | _)        d | _*        g | _+        d | _,        d | _-        d| _.        i | _/        g | _0        i | _1        i | _2        i | _3        d | _4        d | _5        d | _6        d | _7        d S )NÚhandle_sigintÚengineio_loggerÚloggerr   Úmsgpackr   )Úmsgpack_packetÚjsonr   Úmessager   F© )8r   Ú	threadingÚcurrent_threadÚmain_threadr   ÚSIGINTr   ÚreconnectionÚreconnection_attemptsÚreconnection_delayÚreconnection_delay_maxÚrandomization_factorr   Úpopr   ÚPacketÚpacket_classÚ r"   ÚMsgPackPacketr#   Ú_engineio_client_classÚeioÚonÚ_handle_eio_connectÚ_handle_eio_messageÚ_handle_eio_disconnectÚ
isinstanceÚboolr    Údefault_loggerÚlevelÚloggingÚNOTSETÚsetLevelÚINFOÚERRORÚ
addHandlerÚStreamHandlerÚconnection_urlÚconnection_headersÚconnection_authÚconnection_transportsÚconnection_namespacesÚsocketio_pathÚsidÚ	connectedÚ
namespacesÚfailed_namespacesÚhandlersÚnamespace_handlersÚ	callbacksÚ_binary_packetÚ_connect_eventÚ_reconnect_taskr   )Úselfr*   r+   r,   r-   r.   r    Ú
serializerr#   r   ÚkwargsÚengineio_optionsr   r"   s                 r   Ú__init__zBaseClient.__init__&   s¡  € ð
 ð 	DÕ4Ð<ÝÔ(Ñ*Ô*­iÔ.CÑ.EÔ.EÒEÐEÝ&,¤mµF´MÝ4Bñ'Dô 'DÐ#à(ˆÔØ%:ˆÔ"Ø"4ˆÔØ&<ˆÔ#Ø$8ˆÔ!Ø*ˆÔà!ÐØ,9Ð˜Ñ)Ø*×.Ò.Ð/@À$ÑGÔGˆØÐ&Ø)8Ð˜XÑ&Ø˜Ò"Ð"Ý &¤ˆDÔÐØ˜9Ò$Ð$Ø(Ð(Ð(Ð(Ð(Ð(Ø .Ô <ˆDÔÐà *ˆDÔØÐØ%)ˆDÔÔ"Ø'+Ð˜VÑ$à0�4×.Ò.Ñ0Ô0ÐDÐDÐ3CÐDÐDˆŒØŒ�Š�I˜tÔ7Ñ8Ô8Ð8ØŒ�Š�I˜tÔ7Ñ8Ô8Ð8ØŒ�Š�L $Ô"=Ñ>Ô>Ð>å˜&¥$Ñ'Ô'ð 		@Ø ˆDŒKˆKå(ˆDŒKØŒ{Ô ¥G¤NÒ2Ð2Øð 8Ø”K×(Ò(­¬Ñ6Ô6Ð6Ð6à”K×(Ò(­¬Ñ7Ô7Ð7Ø”×&Ò&¥wÔ'<Ñ'>Ô'>Ñ?Ô?Ð?à"ˆÔØ"&ˆÔØ#ˆÔØ%)ˆÔ"Ø%'ˆÔ"Ø!ˆÔØˆŒàˆŒØˆŒØ!#ˆÔØˆŒØ"$ˆÔØˆŒØ"ˆÔØ"ˆÔØ#ˆÔØ $ˆÔÐÐr   c                 ó   — dS )NFr%   ©rU   s    r   Úis_asyncio_basedzBaseClient.is_asyncio_basedi   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')
            def connect_handler():
                print('Connected!')

            # as a method:
            def message_handler(msg):
                print('Received message: ', msg)
                sio.send( 'response')
            sio.on('message', message_handler)

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

        - The ``'connect'`` event handler does not take arguments.
        - The ``'disconnect'`` event handler does not take arguments.
        - The ``'message'`` handler and handlers for custom event names receive
          the message payload as only argument. 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.
        ú/c                 óN   •— ‰‰j         vr
i ‰j         ‰<   | ‰j         ‰         ‰<   | S ©N)rO   )ÚhandlerÚeventÚ	namespacerU   s    €€€r   Úset_handlerz"BaseClient.on.<locals>.set_handlerš   s2   ø€ Ø ¤Ð-Ð-Ø+-�”˜iÑ(Ø.5ˆDŒM˜)Ô$ UÑ+ØˆNr   Nr%   )rU   rb   ra   rc   rd   s   `` ` r   r6   zBaseClient.onl   sX   øøø€ ðX Ð$ ˆ	ð	ð 	ð 	ð 	ð 	ð 	ð 	ð ˆ?ØÐØˆ�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 r`   )r6   Ú__name__)ra   ÚargsrW   rU   s    €€€r   rd   z%BaseClient.event.<locals>.set_handlerÂ   s2   ø€ ØA�w�t”w˜wÔ/ÐA°$ÐAÐAÐA¸&ÐAÐAÀ'ÑJÔJÐJr   )Úlenr
   r6   rg   )rU   rh   rW   rd   s   ``` r   rb   zBaseClient.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 clientN)r:   r   ÚBaseClientNamespaceÚ
ValueErrorr\   Ú_set_clientrP   rc   )rU   Únamespace_handlers     r   Úregister_namespacezBaseClient.register_namespaceÇ   s�   € õ Ð+Ý(Ô<ñ>ô >ð 	9åÐ7Ñ8Ô8Ð8Ø× Ò Ñ"Ô"Ð&7×&HÒ&HÑ&JÔ&JÒJÐJÝÐJÑKÔKÐKØ×%Ò% dÑ+Ô+Ð+àð 	ÔÐ 1Ô ;Ñ<Ð<Ð<r   c                 ó:   — | j                              |pd¦  «        S )a   Return the ``sid`` associated with a connection.

        :param namespace: The Socket.IO namespace. If this argument is omitted
                          the handler is associated with the default
                          namespace. Note that unlike previous versions, the
                          current version of the Socket.IO protocol uses
                          different ``sid`` values per namespace.

        This method returns the ``sid`` for the requested namespace as a
        string.
        r^   )rM   Úget)rU   rc   s     r   Úget_sidzBaseClient.get_sid×   s   € ð Œ×"Ò" 9Ð#3°Ñ4Ô4Ð4r   c                 ó4   — | j                              ¦   «         S )z§Return the name of the transport used by the client.

        The two possible values returned by this function are ``'polling'``
        and ``'websocket'``.
        )r5   Ú	transportr[   s    r   rt   zBaseClient.transportå   s   € ð Œx×!Ò!Ñ#Ô#Ð#r   c                 ó’  — d }|| j         v rU|| j         |         v r| j         |         |         }n–|| j        vr(d| j         |         v r| j         |         d         }|g|¢R }ndd| 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Ú*)rO   Úreserved_events)rU   rb   rc   rh   ra   s        r   Ú_get_event_handlerzBaseClient._get_event_handlerí   s	  € ð ˆØ˜œÐ%Ð%Ø˜œ iÔ0Ð0Ð0Øœ-¨	Ô2°5Ô9��Ø˜dÔ2Ð2Ð2Ø˜4œ=¨Ô3Ð3Ð3Øœ-¨	Ô2°3Ô7�Ø�~ �~�~�øØ�D”MÐ!Ð!Ø˜œ cÔ*Ð*Ð*Øœ-¨Ô,¨UÔ3�Ø!Ð) DÐ)Ð)��Ø˜dÔ2Ð2Ð2Ø˜4œ=¨Ô-Ð-Ð-Øœ-¨Ô,¨SÔ1�Ø˜yÐ0¨4Ð0Ð0�Ø˜ˆ}Ðr   c                 ót   — d }|| j         v r| j         |         }nd| j         v r| j         d         }|g|¢R }||fS rv   )rP   )rU   rc   rh   ra   s       r   Ú_get_namespace_handlerz!BaseClient._get_namespace_handler  s[   € ð ˆØ˜Ô/Ð/Ð/ØÔ-¨iÔ8ˆGˆGØ�DÔ+Ð+Ð+ØÔ-¨cÔ2ˆGØÐ% Ð%Ð%ˆDØ˜ˆ}Ðr   c                 ó¼   — |pd}|| j         vrdt          j        d¦  «        i| j         |<   t          | j         |         d         ¦  «        }|| j         |         |<   |S )z/Generate a unique identifier for an ACK packet.r^   r   r   )rQ   Ú	itertoolsÚcountÚnext)rU   rc   ÚcallbackÚids       r   Ú_generate_ack_idzBaseClient._generate_ack_id  sc   € àÐ$ ˆ	Ø˜DœNÐ*Ð*Ø)*­I¬O¸AÑ,>Ô,>Ð(?ˆDŒN˜9Ñ%Ý�$”. Ô+¨AÔ.Ñ/Ô/ˆØ(0ˆŒ�yÔ! "Ñ%Øˆ	r   c                 ó   — t          ¦   «         ‚r`   ©ÚNotImplementedErrorr[   s    r   r7   zBaseClient._handle_eio_connect  ó   € Ý!Ñ#Ô#Ð#r   c                 ó   — t          ¦   «         ‚r`   r„   )rU   Údatas     r   r8   zBaseClient._handle_eio_message!  r†   r   c                 ó   — t          ¦   «         ‚r`   r„   )rU   Úreasons     r   r9   z!BaseClient._handle_eio_disconnect$  r†   r   c                 ó   — t          ¦   «         ‚r`   r„   r[   s    r   r4   z!BaseClient._engineio_client_class'  r†   r   )	Tr   r   r   r   Fr   NT)NNr`   )rg   Ú
__module__Ú__qualname__rx   ÚengineioÚClientrŠ   rY   r\   r6   rb   ro   rr   rt   ry   r{   r‚   r7   r8   r9   r4   r%   r   r   r   r   !   s#  € € € € € ð-ð -ð -€OàŒ_Ô#€Fà@AØ>?ØDMØ*.ðA%ð A%ð A%ð A%ðFð ð ð6ð 6ð 6ð 6ðp!ð !ð !ðFð ð ð 5ð 5ð 5ð 5ð$ð $ð $ðð ð ð4ð ð ðð ð ð$ð $ð $ð$ð $ð $ð$ð $ð $ð$ð $ð $ð $ð $r   r   )r}   r>   r   r&   rŽ   r2   r   r   Ú	getLoggerr<   r   r   r   r   r%   r   r   ú<module>r‘      sÈ   ðØ Ð Ð Ð Ø €€€Ø €€€Ø Ð Ð Ð à €€€à Ð Ð Ð Ð Ð Ø Ð Ð Ð Ð Ð à"�Ô"Ð#4Ñ5Ô5€ØÐ ð6ð 6ð 6ð Ð ðG$ð G$ð G$ð G$ð G$ñ G$ô G$ð G$ð G$ð G$r   