Skip to content

Commit 251fee1

Browse files
Updated documentation options (Fixes #597)
1 parent 314971c commit 251fee1

File tree

4 files changed

+71
-26
lines changed

4 files changed

+71
-26
lines changed

socketio/asyncio_client.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,10 @@ class AsyncClient(client.Client):
4545
4646
:param request_timeout: A timeout in seconds for requests. The default is
4747
5 seconds.
48+
:param http_session: an initialized ``requests.Session`` object to be used
49+
when sending requests to the server. Use it if you
50+
need to add special client options such as proxy
51+
servers, SSL certificates, etc.
4852
:param ssl_verify: ``True`` to verify SSL certificates, or ``False`` to
4953
skip SSL certificate verification, allowing
5054
connections to servers with self signed certificates.

socketio/asyncio_server.py

Lines changed: 48 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ class AsyncServer(server.Server):
1313
1414
This class implements a fully compliant Socket.IO web server with support
1515
for websocket and long-polling transports, compatible with the asyncio
16-
framework on Python 3.5 or newer.
16+
framework.
1717
1818
:param client_manager: The client manager instance that will manage the
1919
client list. When this is omitted, the client list
@@ -26,46 +26,75 @@ class AsyncServer(server.Server):
2626
packets. Custom json modules must have ``dumps`` and ``loads``
2727
functions that are compatible with the standard library
2828
versions.
29-
:param async_handlers: If set to ``True``, event handlers are executed in
30-
separate threads. To run handlers synchronously,
31-
set to ``False``. The default is ``True``.
29+
:param async_handlers: If set to ``True``, event handlers for a client are
30+
executed in separate threads. To run handlers for a
31+
client synchronously, set to ``False``. The default
32+
is ``True``.
33+
:param always_connect: When set to ``False``, new connections are
34+
provisory until the connect handler returns
35+
something other than ``False``, at which point they
36+
are accepted. When set to ``True``, connections are
37+
immediately accepted, and then if the connect
38+
handler returns ``False`` a disconnect is issued.
39+
Set to ``True`` if you need to emit events from the
40+
connect handler and your client is confused when it
41+
receives events before the connection acceptance.
42+
In any other case use the default of ``False``.
3243
:param kwargs: Connection parameters for the underlying Engine.IO server.
3344
3445
The Engine.IO configuration supports the following settings:
3546
3647
:param async_mode: The asynchronous model to use. See the Deployment
3748
section in the documentation for a description of the
38-
available options. Valid async modes are "aiohttp". If
39-
this argument is not given, an async mode is chosen
40-
based on the installed packages.
49+
available options. Valid async modes are "threading",
50+
"eventlet", "gevent" and "gevent_uwsgi". If this
51+
argument is not given, "eventlet" is tried first, then
52+
"gevent_uwsgi", then "gevent", and finally "threading".
53+
The first async mode that has all its dependencies
54+
installed is then one that is chosen.
55+
:param ping_interval: The interval in seconds at which the server pings
56+
the client. The default is 25 seconds. For advanced
57+
control, a two element tuple can be given, where
58+
the first number is the ping interval and the second
59+
is a grace period added by the server.
4160
:param ping_timeout: The time in seconds that the client waits for the
42-
server to respond before disconnecting.
43-
:param ping_interval: The interval in seconds at which the client pings
44-
the server.
61+
server to respond before disconnecting. The default
62+
is 5 seconds.
4563
:param max_http_buffer_size: The maximum size of a message when using the
46-
polling transport.
47-
:param allow_upgrades: Whether to allow transport upgrades or not.
64+
polling transport. The default is 1,000,000
65+
bytes.
66+
:param allow_upgrades: Whether to allow transport upgrades or not. The
67+
default is ``True``.
4868
:param http_compression: Whether to compress packages when using the
49-
polling transport.
69+
polling transport. The default is ``True``.
5070
:param compression_threshold: Only compress messages when their byte size
51-
is greater than this value.
52-
:param cookie: Name of the HTTP cookie that contains the client session
53-
id. If set to ``None``, a cookie is not sent to the client.
71+
is greater than this value. The default is
72+
1024 bytes.
73+
:param cookie: If set to a string, it is the name of the HTTP cookie the
74+
server sends back tot he client containing the client
75+
session id. If set to a dictionary, the ``'name'`` key
76+
contains the cookie name and other keys define cookie
77+
attributes, where the value of each attribute can be a
78+
string, a callable with no arguments, or a boolean. If set
79+
to ``None`` (the default), a cookie is not sent to the
80+
client.
5481
:param cors_allowed_origins: Origin or list of origins that are allowed to
5582
connect to this server. Only the same origin
5683
is allowed by default. Set this argument to
5784
``'*'`` to allow all origins, or to ``[]`` to
5885
disable CORS handling.
5986
:param cors_credentials: Whether credentials (cookies, authentication) are
60-
allowed in requests to this server.
87+
allowed in requests to this server. The default is
88+
``True``.
6189
:param monitor_clients: If set to ``True``, a background task will ensure
6290
inactive clients are closed. Set to ``False`` to
6391
disable the monitoring task (not recommended). The
6492
default is ``True``.
6593
:param engineio_logger: To enable Engine.IO logging set to ``True`` or pass
6694
a logger object to use. To disable logging set to
67-
``False``. Note that fatal errors are logged even
68-
when ``engineio_logger`` is ``False``.
95+
``False``. The default is ``False``. Note that
96+
fatal errors are logged even when
97+
``engineio_logger`` is ``False``.
6998
"""
7099
def __init__(self, client_manager=None, logger=False, json=None,
71100
async_handlers=True, **kwargs):

socketio/client.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,10 @@ class Client(object):
6666
6767
:param request_timeout: A timeout in seconds for requests. The default is
6868
5 seconds.
69+
:param http_session: an initialized ``requests.Session`` object to be used
70+
when sending requests to the server. Use it if you
71+
need to add special client options such as proxy
72+
servers, SSL certificates, etc.
6973
:param ssl_verify: ``True`` to verify SSL certificates, or ``False`` to
7074
skip SSL certificate verification, allowing
7175
connections to servers with self signed certificates.

socketio/server.py

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -54,13 +54,16 @@ class Server(object):
5454
"gevent_uwsgi", then "gevent", and finally "threading".
5555
The first async mode that has all its dependencies
5656
installed is then one that is chosen.
57+
:param ping_interval: The interval in seconds at which the server pings
58+
the client. The default is 25 seconds. For advanced
59+
control, a two element tuple can be given, where
60+
the first number is the ping interval and the second
61+
is a grace period added by the server.
5762
:param ping_timeout: The time in seconds that the client waits for the
5863
server to respond before disconnecting. The default
59-
is 60 seconds.
60-
:param ping_interval: The interval in seconds at which the client pings
61-
the server. The default is 25 seconds.
64+
is 5 seconds.
6265
:param max_http_buffer_size: The maximum size of a message when using the
63-
polling transport. The default is 100,000,000
66+
polling transport. The default is 1,000,000
6467
bytes.
6568
:param allow_upgrades: Whether to allow transport upgrades or not. The
6669
default is ``True``.
@@ -69,9 +72,14 @@ class Server(object):
6972
:param compression_threshold: Only compress messages when their byte size
7073
is greater than this value. The default is
7174
1024 bytes.
72-
:param cookie: Name of the HTTP cookie that contains the client session
73-
id. If set to ``None``, a cookie is not sent to the client.
74-
The default is ``'io'``.
75+
:param cookie: If set to a string, it is the name of the HTTP cookie the
76+
server sends back tot he client containing the client
77+
session id. If set to a dictionary, the ``'name'`` key
78+
contains the cookie name and other keys define cookie
79+
attributes, where the value of each attribute can be a
80+
string, a callable with no arguments, or a boolean. If set
81+
to ``None`` (the default), a cookie is not sent to the
82+
client.
7583
:param cors_allowed_origins: Origin or list of origins that are allowed to
7684
connect to this server. Only the same origin
7785
is allowed by default. Set this argument to

0 commit comments

Comments
 (0)