@@ -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 ):
0 commit comments