打开页面时为什么会一直发送GET 请求?能不能关闭这个选项 #578
Unanswered
DuckDuck88
asked this question in
Q&A
Replies: 2 comments
-
因为pywebio是允许server “主动” 向用户发消息的,而http请求只能从浏览器发起,所以在使用http协议的后端时,只能定时轮训server来看有没有新消息。 可以通过 https://pywebio.readthedocs.io/zh_CN/latest/session.html#pywebio.session.set_env |
Beta Was this translation helpful? Give feedback.
0 replies
-
原来是这个原理,明白啦谢谢。
顺带补充一下你刚刚回复我 nginx 中转的问题。通过nginx 中转时并没有轮训请求。
发自我的iPhone
…------------------ 原始邮件 ------------------
发件人: WangWeimin ***@***.***>
发送时间: 2023年6月7日 20:40
收件人: pywebio/PyWebIO ***@***.***>
抄送: DuuuckYa ***@***.***>, Author ***@***.***>
主题: Re: [pywebio/PyWebIO] 打开页面时为什么会一直发送GET 请求?能不能关闭这个选项 (Discussion #578)
因为pywebio是允许server “主动” 向用户发消息的,而http请求只能从浏览器发起,所以在使用http协议的后端时,只能定时轮训server来看有没有新消息。
可以通过 pywebio.session.set_env(http_pull_interval) 来修改轮训间隔,如果你的server不会主动发消息,只是被动响应各种事件(表单提交,按钮点击)你可以尝试把 http_pull_interval 调大
https://pywebio.readthedocs.io/zh_CN/latest/session.html#pywebio.session.set_env
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you authored the thread.Message ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
例如打开 http:xxxx/weread_to_noiton?xxx页面时,会一直发送如下请求:
"GET /weread_to_noiton?app=index&ack=4 HTTP/1.1" 200
"GET /weread_to_noiton?app=index&ack=4 HTTP/1.1" 200
"GET /weread_to_noiton?app=index&ack=4 HTTP/1.1" 200
"GET /weread_to_noiton?app=index&ack=4 HTTP/1.1" 200
Beta Was this translation helpful? Give feedback.
All reactions