Coder Social home page Coder Social logo

Comments (5)

wang0618 avatar wang0618 commented on June 14, 2024

后续版本会考虑加入websocket会话重连功能。

目前可以考虑使用基于http的会话来防止休眠导致的会话断开,参考 pywebio.platform.flask.start_server(), (可以将 session_expire_seconds 设置大一些)

from pywebio.

wang0618 avatar wang0618 commented on June 14, 2024

最新的 v1.2 版本中,Websocket连接可以通过在 start_server() 中设定 reconnect_timeout 参数来支持会话重连。

参见:https://pywebio.readthedocs.io/zh_CN/latest/platform.html?highlight=reconnect_timeout#pywebio.platform.tornado.start_server

from pywebio.

StoneMoe avatar StoneMoe commented on June 14, 2024

看起来很赞!
是否有可能设置永不超时,随时可以重连呢?

from pywebio.

wang0618 avatar wang0618 commented on June 14, 2024

是否有可能设置永不超时,随时可以重连呢?

会话重连功能需要将连接断开的会话维护起来,如果永不超时,那些无人访问的会话将一直占用内存无法被清理。为了防止内存泄漏,一定要加上超时时间,应用可以根据需要调整超时时间大小。

from pywebio.

StoneMoe avatar StoneMoe commented on June 14, 2024

感谢回复~
转念一想,设置一个超大的超时时间也确实是与无限时间相比更优的选择。
我理解这个问题作为阻止休眠的替代方案已经足够了,就先擅自关闭issue了。

from pywebio.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.