Skip to content

Commit a0b20f0

Browse files
committed
Document that only asyncio supports keepalive.
Fix #1508.
1 parent d62e423 commit a0b20f0

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

docs/topics/keepalive.rst

+7-8
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
Keepalive and latency
22
=====================
33

4+
.. admonition:: This guide applies only to the :mod:`asyncio` implementation.
5+
:class: tip
6+
7+
The :mod:`threading` implementation doesn't provide keepalive yet.
8+
49
.. currentmodule:: websockets
510

611
Long-lived connections
@@ -31,14 +36,8 @@ based on WebSocket Ping_ and Pong_ frames, which are designed for this purpose.
3136
.. _Ping: https://www.rfc-editor.org/rfc/rfc6455.html#section-5.5.2
3237
.. _Pong: https://www.rfc-editor.org/rfc/rfc6455.html#section-5.5.3
3338

34-
It loops through these steps:
35-
36-
1. Wait 20 seconds.
37-
2. Send a Ping frame.
38-
3. Receive a corresponding Pong frame within 20 seconds.
39-
40-
If the Pong frame isn't received, websockets considers the connection broken and
41-
closes it.
39+
It sends a Ping frame every 20 seconds. It expects a Pong frame in return within
40+
20 seconds. Else, it considers the connection broken and terminates it.
4241

4342
This mechanism serves three purposes:
4443

0 commit comments

Comments
 (0)