You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
3.10.0 (2024-10-21)
------------------
**Added**
- Automatic Advanced Keep-Alive for HTTP/2 and HTTP/3 over QUIC by
sending PING frames.
New Session, and Adapter parameters are now available:
`keepalive_delay`, and `keepalive_idle_window`.
This greatly improves your daily experience working with HTTP/2+ remote
peers.
**Fixed**
- Unshielded picotls assertion error in Python < 3.10 when trying to
fetch the peer intermediate certificate. (#157)
Copy file name to clipboardexpand all lines: docs/user/quickstart.rst
+26
Original file line number
Diff line number
Diff line change
@@ -1249,6 +1249,32 @@ See::
1249
1249
1250
1250
.. note:: The given example are really basic ones. You may adjust at will the settings and algorithm to match your requisites.
1251
1251
1252
+
Keep-Alive
1253
+
----------
1254
+
1255
+
.. note:: Available since Niquests v3.10 and before this only HTTP/1.1 were kept alive properly.
1256
+
1257
+
Niquests can automatically make sure that your HTTP connection is kept alive
1258
+
no matter the used protocol using a discrete scheduled task for each host.
1259
+
1260
+
.. code-block:: python
1261
+
1262
+
import niquests
1263
+
1264
+
sess = niquests.Session(keepalive_delay=300, keepalive_idle_window=60) # already the defaults!, you don't need to specify anything
1265
+
1266
+
In that example, we indicate that we wish to keep a connection alive for 5 minutes and
1267
+
eventually send ping every 60s after the connection was idle. (Those values are the default ones!)
1268
+
1269
+
The pings are only sent when using HTTP/2 or HTTP/3 over QUIC. Any connection activity is considered as used, therefor
1270
+
making the ping only 60s after zero activity. If the connection receive unsolicited data, it is also considered used.
1271
+
1272
+
.. note:: Setting either keepalive_delay or keepalive_idle_window to None disable this feature.
1273
+
1274
+
.. warning:: We do not recommend setting anything lower than 30s for keepalive_idle_window. Anything lower than 1s is considered to be 1s. High frequency ping will lower the performance of your connection pool. And probably end up by getting kicked out by the server.
1275
+
1276
+
Once the ``keepalive_delay`` passed, we do not close the connection, we simply cease to ensure it is alive. This is purely for backward compatibility with our predecessor, as some host may retain the connection for hours.
1277
+
1252
1278
-----------------------
1253
1279
1254
1280
Ready for more? Check out the :ref:`advanced <advanced>` section.
0 commit comments