| 1 |
Client (legacy) |
| 2 |
=============== |
| 3 |
|
| 4 |
.. admonition:: The legacy :mod:`asyncio` implementation is deprecated. |
| 5 |
:class: caution |
| 6 |
|
| 7 |
The :doc:`upgrade guide <../../howto/upgrade>` provides complete instructions |
| 8 |
to migrate your application. |
| 9 |
|
| 10 |
.. automodule:: websockets.legacy.client |
| 11 |
|
| 12 |
Opening a connection |
| 13 |
-------------------- |
| 14 |
|
| 15 |
.. 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) |
| 16 |
|
| 17 |
.. 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) |
| 18 |
|
| 19 |
Using a connection |
| 20 |
------------------ |
| 21 |
|
| 22 |
.. 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) |
| 23 |
|
| 24 |
.. automethod:: recv |
| 25 |
|
| 26 |
.. automethod:: send |
| 27 |
|
| 28 |
.. automethod:: close |
| 29 |
|
| 30 |
.. automethod:: wait_closed |
| 31 |
|
| 32 |
.. automethod:: ping |
| 33 |
|
| 34 |
.. automethod:: pong |
| 35 |
|
| 36 |
WebSocket connection objects also provide these attributes: |
| 37 |
|
| 38 |
.. autoattribute:: id |
| 39 |
|
| 40 |
.. autoattribute:: logger |
| 41 |
|
| 42 |
.. autoproperty:: local_address |
| 43 |
|
| 44 |
.. autoproperty:: remote_address |
| 45 |
|
| 46 |
.. autoproperty:: open |
| 47 |
|
| 48 |
.. autoproperty:: closed |
| 49 |
|
| 50 |
.. autoattribute:: latency |
| 51 |
|
| 52 |
The following attributes are available after the opening handshake, |
| 53 |
once the WebSocket connection is open: |
| 54 |
|
| 55 |
.. autoattribute:: path |
| 56 |
|
| 57 |
.. autoattribute:: request_headers |
| 58 |
|
| 59 |
.. autoattribute:: response_headers |
| 60 |
|
| 61 |
.. autoattribute:: subprotocol |
| 62 |
|
| 63 |
The following attributes are available after the closing handshake, |
| 64 |
once the WebSocket connection is closed: |
| 65 |
|
| 66 |
.. autoproperty:: close_code |
| 67 |
|
| 68 |
.. autoproperty:: close_reason |