@@ -70,7 +70,7 @@ def webio_view(target,
70
70
session_expire_seconds = None ,
71
71
session_cleanup_interval = None ,
72
72
allowed_origins = None , check_origin = None ):
73
- """获取用于与后端实现进行整合的view函数, 基于http请求与前端进行通讯
73
+ """获取在Flask中运行PyWebIO任务的视图函数。 基于http请求与前端进行通讯
74
74
75
75
:param target: 任务函数。任务函数为协程函数时,使用 :ref:`基于协程的会话实现 <coroutine_based_session>` ;任务函数为普通函数时,使用基于线程的会话实现。
76
76
:param int session_expire_seconds: 会话不活跃过期时间。
@@ -108,12 +108,11 @@ def start_server(target, port=8080, host='localhost',
108
108
session_cleanup_interval = None ,
109
109
session_expire_seconds = None ,
110
110
debug = False , ** flask_options ):
111
- """启动一个 Flask server 来运行PyWebIO的 ``target`` 服务
111
+ """启动一个 Flask server 将 ``target`` 任务函数作为Web服务提供。
112
112
113
- :param target: task function. It's a coroutine function is use CoroutineBasedSession or
114
- a simple function is use ThreadBasedSession.
115
- :param port: server bind port. set ``0`` to find a free port number to use
116
- :param host: server bind host. ``host`` may be either an IP address or hostname. If it's a hostname,
113
+ :param target: 任务函数。任务函数为协程函数时,使用 :ref:`基于协程的会话实现 <coroutine_based_session>` ;任务函数为普通函数时,使用基于线程的会话实现。
114
+ :param int port: server bind port. set ``0`` to find a free port number to use
115
+ :param str host: server bind host. ``host`` may be either an IP address or hostname. If it's a hostname,
117
116
:param list allowed_origins: 除当前域名外,服务器还允许的请求的来源列表。
118
117
来源包含协议和域名和端口部分,允许使用 Unix shell 风格的匹配模式:
119
118
@@ -128,7 +127,7 @@ def start_server(target, port=8080, host='localhost',
128
127
:param bool disable_asyncio: 禁用 asyncio 函数。仅在 ``target`` 为协程函数时有效。
129
128
130
129
.. note:: 实现说明:
131
- 当使用Flask backend时,若要在PyWebIO的会话中使用 ``asyncio`` 标准库里的协程函数,则需要在单独开启一个线程来运行 ``asyncio`` 事件循环,
130
+ 当使用Flask backend时,若要在PyWebIO的会话中使用 ``asyncio`` 标准库里的协程函数,PyWebIO需要单独开启一个线程来运行 ``asyncio`` 事件循环,
132
131
若程序中没有使用到 ``asyncio`` 中的异步函数,可以开启此选项来避免不必要的资源浪费
133
132
134
133
:param int session_expire_seconds: 会话过期时间。若 session_expire_seconds 秒内没有收到客户端的请求,则认为会话过期。
0 commit comments