简体   繁体   English

如何在 django 通道中设置连接超时?

[英]How to set connection-timeout in django channel?

Django channels disconnect the client if it doesn't respond for few seconds.如果客户端几秒钟没有响应,Django 通道将断开客户端。 But I can't find where to set that time limit.但我找不到在哪里设置这个时间限制。 i checked this issue.我检查了这个问题。 It says it will be configurable.But I can't find where to set that limit.它说它将是可配置的。但我找不到在哪里设置该限制。 thank you谢谢你

I solved this by modifying daphne's code and reinstalling it.我通过修改达芙妮的代码并重新安装它来解决这个问题。

  1. Download daphne source code from github从 github 下载 daphne 源代码

  2. Change ping_interval,ping_timeout in server.py as per your needs.Default is 20,30 (in seconds)根据您的需要更改server.py中的ping_interval,ping_timeout 。默认为 20,30(以秒为单位)

  3. Install daphne using pip install -e /path/to/daphne/(where setup.py is located) Thats all!使用pip install -e /path/to/daphne/(where setup.py is located)安装 daphne 就是这样!

` `

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM