
    vKgG                     p    S r SSKJrJrJr  SSKJrJrJr  SSK	J
r
  SSKJr  SSKJr  Sr " S	 S
5      rSrg)z.
wsproto
~~~~~~~

A WebSocket implementation.
    )	GeneratorOptionalUnion   )
ConnectionConnectionStateConnectionType)Event)H11Handshake)Headersz1.2.0c                       \ rS rSrSrS\SS4S jr\S\4S j5       r	S\
S	\\\4   SS4S
 jrS\S\4S jrS\\   SS4S jrS\\SS4   4S jrSrg)WSConnection   zF
Represents the local end of a WebSocket connection to a remote peer.
connection_typereturnNc                 `    U[         R                  L U l        [        U5      U l        SU l        g)z
Constructor

:param wsproto.connection.ConnectionType connection_type: Controls
    whether the library behaves as a client or as a server.
N)r	   CLIENTclientr   	handshake
connection)selfr   s     P/var/www/highfloat_scraper/venv/lib/python3.13/site-packages/wsproto/__init__.py__init__WSConnection.__init__   s)     &)>)>>%o604    c                 t    U R                   c  U R                  R                  $ U R                   R                  $ )zG
:returns: Connection state
:rtype: wsproto.connection.ConnectionState
)r   r   stater   s    r   r   WSConnection.state!   s.     ??">>'''$$$r   headerspathc                 :    U R                   R                  X5        g )N)r   initiate_upgrade_connection)r   r    r!   s      r   r#   (WSConnection.initiate_upgrade_connection+   s     	227Ar   eventc                     SnU R                   c:  X R                  R                  U5      -  nU R                  R                   U l         U$ X R                   R                  U5      -  nU$ )aS  
Generate network data for the specified event.

When you want to communicate with a WebSocket peer, you should construct
an event and pass it to this method. This method will return the bytes
that you should send to the peer.

:param wsproto.events.Event event: The event to generate data for
:returns bytes: The data to send to the peer
r   )r   r   send)r   r%   datas      r   r'   WSConnection.send0   s`     ??"NN''..D"nn77DO  OO((//Dr   r(   c                     U R                   c7  U R                  R                  U5        U R                  R                   U l         gU R                   R                  U5        g)z
Feed network data into the connection instance.

After calling this method, you should call :meth:`events` to see if the
received data triggered any new events.

:param bytes data: Data received from remote peer
N)r   r   receive_data)r   r(   s     r   r+   WSConnection.receive_dataC   sC     ??"NN''-"nn77DOOO((.r   c              #      #    U R                   R                  5        Sh  vN   U R                  b#  U R                  R                  5        Sh  vN   gg N5 N7f)zt
A generator that yields pending events.

Each event is an instance of a subclass of
:class:`wsproto.events.Event`.
N)r   eventsr   r   s    r   r.   WSConnection.eventsR   sJ      >>((***??&--/// ' 	+/s!   AA.AAAA)r   r   r   )__name__
__module____qualname____firstlineno____doc__r	   r   propertyr   r   r   r   bytesstrr#   r
   r'   r   r+   r   r.   __static_attributes__ r   r   r   r      s    	5 	54 	5 % % %BB&+E3J&7B	B
% E &/% /T /	0	%t"34 	0r   r   )r	   r   N)r4   typingr   r   r   r   r   r   r	   r.   r
   r   r   r   __version__r   __all__r9   r   r   <module>r=      s:    . - C C  # J0 J0Z -r   