Debian Codegraph @

testing/web-platform/tests/tools/third_party/websockets/docs/reference/asyncio/client.rst

raw
1 Client (:mod:`asyncio`)
2 =======================
3
4 .. automodule:: websockets.client
5
6 Opening a connection
7 --------------------
8
9 .. autofunction:: connect(uri, *, create_protocol=None, logger=None, compression="deflate", origin=None, extensions=None, subprotocols=None, extra_headers=None, user_agent_header="Python/x.y.z websockets/X.Y", open_timeout=10, ping_interval=20, ping_timeout=20, close_timeout=10, max_size=2 ** 20, max_queue=2 ** 5, read_limit=2 ** 16, write_limit=2 ** 16, **kwds)
10 :async:
11
12 .. autofunction:: unix_connect(path, uri="ws://localhost/", *, create_protocol=None, logger=None, compression="deflate", origin=None, extensions=None, subprotocols=None, extra_headers=None, user_agent_header="Python/x.y.z websockets/X.Y", open_timeout=10, ping_interval=20, ping_timeout=20, close_timeout=10, max_size=2 ** 20, max_queue=2 ** 5, read_limit=2 ** 16, write_limit=2 ** 16, **kwds)
13 :async:
14
15 Using a connection
16 ------------------
17
18 .. autoclass:: WebSocketClientProtocol(*, logger=None, origin=None, extensions=None, subprotocols=None, extra_headers=None, user_agent_header="Python/x.y.z websockets/X.Y", ping_interval=20, ping_timeout=20, close_timeout=10, max_size=2 ** 20, max_queue=2 ** 5, read_limit=2 ** 16, write_limit=2 ** 16)
19
20 .. automethod:: recv
21
22 .. automethod:: send
23
24 .. automethod:: close
25
26 .. automethod:: wait_closed
27
28 .. automethod:: ping
29
30 .. automethod:: pong
31
32 WebSocket connection objects also provide these attributes:
33
34 .. autoattribute:: id
35
36 .. autoattribute:: logger
37
38 .. autoproperty:: local_address
39
40 .. autoproperty:: remote_address
41
42 .. autoproperty:: open
43
44 .. autoproperty:: closed
45
46 .. autoattribute:: latency
47
48 The following attributes are available after the opening handshake,
49 once the WebSocket connection is open:
50
51 .. autoattribute:: path
52
53 .. autoattribute:: request_headers
54
55 .. autoattribute:: response_headers
56
57 .. autoattribute:: subprotocol
58
59 The following attributes are available after the closing handshake,
60 once the WebSocket connection is closed:
61
62 .. autoproperty:: close_code
63
64 .. autoproperty:: close_reason