@@ -13,7 +13,7 @@ class AsyncServer(server.Server):
13
13
14
14
This class implements a fully compliant Socket.IO web server with support
15
15
for websocket and long-polling transports, compatible with the asyncio
16
- framework on Python 3.5 or newer .
16
+ framework.
17
17
18
18
:param client_manager: The client manager instance that will manage the
19
19
client list. When this is omitted, the client list
@@ -26,46 +26,75 @@ class AsyncServer(server.Server):
26
26
packets. Custom json modules must have ``dumps`` and ``loads``
27
27
functions that are compatible with the standard library
28
28
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``.
32
43
:param kwargs: Connection parameters for the underlying Engine.IO server.
33
44
34
45
The Engine.IO configuration supports the following settings:
35
46
36
47
:param async_mode: The asynchronous model to use. See the Deployment
37
48
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.
41
60
: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.
45
63
: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``.
48
68
:param http_compression: Whether to compress packages when using the
49
- polling transport.
69
+ polling transport. The default is ``True``.
50
70
: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.
54
81
:param cors_allowed_origins: Origin or list of origins that are allowed to
55
82
connect to this server. Only the same origin
56
83
is allowed by default. Set this argument to
57
84
``'*'`` to allow all origins, or to ``[]`` to
58
85
disable CORS handling.
59
86
: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``.
61
89
:param monitor_clients: If set to ``True``, a background task will ensure
62
90
inactive clients are closed. Set to ``False`` to
63
91
disable the monitoring task (not recommended). The
64
92
default is ``True``.
65
93
:param engineio_logger: To enable Engine.IO logging set to ``True`` or pass
66
94
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``.
69
98
"""
70
99
def __init__ (self , client_manager = None , logger = False , json = None ,
71
100
async_handlers = True , ** kwargs ):
0 commit comments