
    vKg+                     *   S r SSKJr  SSKJrJr  SSKJrJrJ	r	J
r
JrJr  SSKJr  SSKJr   " S S	\5      r\" S
S9 " S S\5      5       r\" S
S9 " S S\5      5       r\" S
S9 " S S\5      5       r\" S
S9 " S S\5      5       r\" S
S9 " S S\5      5       r\" S\\5      r\" S
S9 " S S\\\   5      5       r\" S
S9 " S S\\   5      5       r\" S
S9 " S S\\   5      5       r\" S
S9 " S S\5      5       r\" S
S9 " S S \5      5       rg!)"zc
wsproto/events
~~~~~~~~~~~~~~

Events that result from processing data on a WebSocket connection.
    )ABC)	dataclassfield)GenericListOptionalSequenceTypeVarUnion   )	Extension)Headersc                       \ rS rSrSrSrg)Event   z 
Base class for wsproto events.
 N)__name__
__module____qualname____firstlineno____doc____static_attributes__r       N/var/www/highfloat_scraper/venv/lib/python3.13/site-packages/wsproto/events.pyr   r      s     	r   r   T)frozenc                       \ rS rSr% Sr\\S'   \\S'   \" \S9r	\
\\   \\   4   \S'   \" \S9r\\S'   \" \S9r\\   \S'   S	rg
)Request   a  The beginning of a Websocket connection, the HTTP Upgrade request

This event is fired when a SERVER connection receives a WebSocket
handshake request (HTTP with upgrade header).

Fields:

.. attribute:: host

   (Required) The hostname, or host header value.

.. attribute:: target

   (Required) The request target (path and query string)

.. attribute:: extensions

   The proposed extensions.

.. attribute:: extra_headers

   The additional request headers, excluding extensions, host, subprotocols,
   and version headers.

.. attribute:: subprotocols

   A list of the subprotocols proposed in the request, as a list
   of strings.
hosttargetdefault_factory
extensionsextra_headerssubprotocolsr   N)r   r   r   r   r   str__annotations__r   listr#   r   r	   r   r$   r   r%   r   r   r   r   r   r   r      s^    < IK<A=Jhy)8C=89  #48M78#D9L$s)9r   r   c                   `    \ rS rSr% SrSr\\   \S'   \	" \
S9r\\   \S'   \	" \
S9r\\S'   Srg)	AcceptConnection@   a  The acceptance of a Websocket upgrade request.

This event is fired when a CLIENT receives an acceptance response
from a server. It is also used to accept an upgrade request when
acting as a SERVER.

Fields:

.. attribute:: extra_headers

   Any additional (non websocket related) headers present in the
   acceptance response.

.. attribute:: subprotocol

   The accepted subprotocol to use.

Nsubprotocolr!   r#   r$   r   )r   r   r   r   r   r,   r   r&   r'   r   r(   r#   r   r   r$   r   r   r   r   r   r*   r*   @   s9    & "&K#%"'"=JY="48M78r   r*   c                   L    \ rS rSr% SrSr\\S'   \" \	S9r
\\S'   Sr\\S'   S	rg
)RejectConnectionZ   aT  The rejection of a Websocket upgrade request, the HTTP response.

The ``RejectConnection`` event sends the appropriate HTTP headers to
communicate to the peer that the handshake has been rejected. You may also
send an HTTP body by setting the ``has_body`` attribute to ``True`` and then
sending one or more :class:`RejectData` events after this one. When sending
a response body, the caller should set the ``Content-Length``,
``Content-Type``, and/or ``Transfer-Encoding`` headers as appropriate.

When receiving a ``RejectConnection`` event, the ``has_body`` attribute will
in almost all cases be ``True`` (even if the server set it to ``False``) and
will be followed by at least one ``RejectData`` events, even though the data
itself might be just ``b""``. (The only scenario in which the caller
receives a ``RejectConnection`` with ``has_body == False`` is if the peer
violates sends an informational status code (1xx) other than 101.)

The ``has_body`` attribute should only be used when receiving the event. (It
has ) is False the headers must include a
content-length or transfer encoding.

Fields:

.. attribute:: headers (Headers)

   The headers to send with the response.

.. attribute:: has_body

   This defaults to False, but set to True if there is a body. See
   also :class:`~RejectData`.

.. attribute:: status_code

   The response status code.

i  status_coder!   headersFhas_bodyr   N)r   r   r   r   r   r0   intr'   r   r(   r1   r   r2   boolr   r   r   r   r.   r.   Z   s-    #J KT2GW2Hdr   r.   c                   2    \ rS rSr% Sr\\S'   Sr\\S'   Sr	g)
RejectData   aA  The rejection HTTP response body.

The caller may send multiple ``RejectData`` events. The final event should
have the ``body_finished`` attribute set to ``True``.

Fields:

.. attribute:: body_finished

   True if this is the final chunk of the body data.

.. attribute:: data (bytes)

   (Required) The raw body data.

dataTbody_finishedr   N)
r   r   r   r   r   bytesr'   r9   r4   r   r   r   r   r6   r6      s    " KM4r   r6   c                   B    \ rS rSr% Sr\\S'   Sr\\	   \S'   SS jr
Srg)	CloseConnection   ai  The end of a Websocket connection, represents a closure frame.

**wsproto does not automatically send a response to a close event.** To
comply with the RFC you MUST send a close event back to the remote WebSocket
if you have not already sent one. The :meth:`response` method provides a
suitable event for this purpose, and you should check if a response needs
to be sent by checking :func:`wsproto.WSConnection.state`.

Fields:

.. attribute:: code

   (Required) The integer close code to indicate why the connection
   has closed.

.. attribute:: reason

   Additional reasoning for why the connection has closed.

codeNreasonc                 >    [        U R                  U R                  S9$ )z?Generate an RFC-compliant close frame to send back to the peer.)r>   r?   )r<   r>   r?   selfs    r   responseCloseConnection.response   s    DIIdkkBBr   r   )returnr<   )r   r   r   r   r   r3   r'   r?   r   r&   rC   r   r   r   r   r<   r<      s"    * I FHSM Cr   r<   Tc                   @    \ rS rSr% Sr\\S'   Sr\\S'   Sr	\\S'   Sr
g)	Message   a  The websocket data message.

Fields:

.. attribute:: data

   (Required) The message data as byte string, can be decoded as UTF-8 for
   TEXT messages.  This only represents a single chunk of data and
   not a full WebSocket message.  You need to buffer and
   reassemble these chunks to get the full message.

.. attribute:: frame_finished

   This has no semantic content, but is provided just in case some
   weird edge case user wants to be able to reconstruct the
   fragmentation pattern of the original stream.

.. attribute:: message_finished

   True if this frame is the last one of this message, False if
   more frames are expected.

r8   Tframe_finishedmessage_finishedr   N)r   r   r   r   r   rF   r'   rJ   r4   rK   r   r   r   r   rH   rH      s#    0 GND!d!r   rH   c                   $    \ rS rSr% Sr\\S'   Srg)TextMessage   a!  This event is fired when a data frame with TEXT payload is received.

Fields:

.. attribute:: data

   The message data as string, This only represents a single chunk
   of data and not a full WebSocket message.  You need to buffer
   and reassemble these chunks to get the full message.

r8   r   N)r   r   r   r   r   r&   r'   r   r   r   r   rM   rM      s    
 Ir   rM   c                   $    \ rS rSr% Sr\\S'   Srg)BytesMessage   aV  This event is fired when a data frame with BINARY payload is
received.

Fields:

.. attribute:: data

   The message data as byte string, can be decoded as UTF-8 for
   TEXT messages.  This only represents a single chunk of data and
   not a full WebSocket message.  You need to buffer and
   reassemble these chunks to get the full message.
r8   r   N)r   r   r   r   r   r:   r'   r   r   r   r   rP   rP      s     Kr   rP   c                   2    \ rS rSr% SrSr\\S'   SS jrSr	g)	Pingi  a  The Ping event can be sent to trigger a ping frame and is fired
when a Ping is received.

**wsproto does not automatically send a pong response to a ping event.** To
comply with the RFC you MUST send a pong even as soon as is practical. The
:meth:`response` method provides a suitable event for this purpose.

Fields:

.. attribute:: payload

   An optional payload to emit with the ping frame.
r   payloadc                 (    [        U R                  S9$ )z>Generate an RFC-compliant :class:`Pong` response to this ping.)rT   )PongrT   rA   s    r   rC   Ping.response  s    DLL))r   r   N)rE   rV   )
r   r   r   r   r   rT   r:   r'   rC   r   r   r   r   rS   rS     s     GU*r   rS   c                   (    \ rS rSr% SrSr\\S'   Srg)rV   i  zThe Pong event is fired when a Pong is received.

Fields:

.. attribute:: payload

   An optional payload to emit with the pong frame.

r   rT   r   N)	r   r   r   r   r   rT   r:   r'   r   r   r   r   rV   rV     s     GUr   rV   N)r   abcr   dataclassesr   r   typingr   r   r   r	   r
   r   r#   r   r   r   r   r*   r.   r6   r<   r:   r&   rF   rH   rM   rP   rS   rV   r   r   r   <module>r\      s    ( D D ! 	C 	 $%:e %: %:P $9u 9 92 $(u ( (V $  , $Ce C C> C $"eWQZ " "< $'#,  " $75>  $ $*5 * *, $5  r   