zmc
2023-12-22 9fdbf60165db0400c2e8e6be2dc6e88138ac719a
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
U
[±dG ã@sjdZddlmZmZmZddlmZmZmZddl    m
Z
ddl m Z ddlm Z dZGd    d
„d
ƒZd Zd S) z.
wsproto
~~~~~~~
 
A WebSocket implementation.
é)Ú    GeneratorÚOptionalÚUnioné)Ú
ConnectionÚConnectionStateÚConnectionType)ÚEvent)Ú H11Handshake)ÚHeadersz1.2.0c@sˆeZdZdZeddœdd„Zeedœdd„ƒZe    e
e e fdd    œd
d „Z ee d œd d„Zee ddœdd„Zeeddfdœdd„ZdS)Ú WSConnectionzN
    Represents the local end of a WebSocket connection to a remote peer.
    N)Úconnection_typeÚreturncCs |tjk|_t|ƒ|_d|_dS)z­
        Constructor
 
        :param wsproto.connection.ConnectionType connection_type: Controls
            whether the library behaves as a client or as a server.
        N)rZCLIENTÚclientr
Ú    handshakeÚ
connection)Úselfr ©rúGd:\z\workplace\vscode\pyvenv\venv\Lib\site-packages\wsproto/__init__.pyÚ__init__s 
zWSConnection.__init__)rcCs|jdkr|jjS|jjS)z_
        :returns: Connection state
        :rtype: wsproto.connection.ConnectionState
        N)rrÚstate©rrrrr!s
zWSConnection.state)ÚheadersÚpathrcCs|j ||¡dS)N)rÚinitiate_upgrade_connection)rrrrrrr+sz(WSConnection.initiate_upgrade_connection)ÚeventrcCs>d}|jdkr*||j |¡7}|jj|_n||j |¡7}|S)a‹
        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
        óN)rrÚsend)rrÚdatarrrr0s 
 zWSConnection.send)rrcCs2|jdkr"|j |¡|jj|_n |j |¡dS)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)rrÚ receive_data)rrrrrrCs    
  zWSConnection.receive_dataccs.|j ¡EdH|jdk    r*|j ¡EdHdS)z”
        A generator that yields pending events.
 
        Each event is an instance of a subclass of
        :class:`wsproto.events.Event`.
        N)rÚeventsrrrrrr Rs
zWSConnection.events)Ú__name__Ú
__module__Ú __qualname__Ú__doc__rrÚpropertyrrr rÚbytesÚstrrr    rrrrr rrrrr s 
 
þ r )rr N)r$Útypingrrrrrrrr r    rr
r Ú __version__r Ú__all__rrrrÚ<module>s   M