Comments (7)
协程服务端是看客户端的请求头中的Connection来设置长链接的,不用手动设置
from swoole-src.
https://wiki.swoole.com/#/server/setting?id=open_tcp_keepalive
最终要解决的问题是检测死连接
,通过这几个参数控制调整自己业务所能容忍的检测周期
from swoole-src.
这几个参数协程化服务端没法设置
from swoole-src.
那目前协程服务端在检测死连接的问题有做相关的处理么
from swoole-src.
目前不支持
from swoole-src.
有在计划中?
另一个问题:协程风格websocket server::close无法传参code和reason
// 异步风格
Swoole\WebSocket\Server->disconnect(int $fd, int $code = SWOOLE_WEBSOCKET_CLOSE_NORMAL, string $reason = ''): bool
【根据 RFC6455,对于应用程序关闭连接状态码,取值范围为 1000 或 4000-4999 之间】
from swoole-src.
- 协程 Server 建议使用 PHP 代码创建一个定时器,轮询切断超时的连接
Response::push()
可以支持发送SWOOLE_WEBSOCKET_OPCODE_CLOSE
类型的 frame,传递 code 和 reason
$server = new Co\Http\Server("127.0.0.1", 9502, false);
$server->handle('/websocket', function ($request, $ws) {
$ws->upgrade();
sleep(1);
$frame = new Swoole\WebSocket\CloseFrame;
$frame->reason = 'close';
$ws->push($frame);
});
from swoole-src.
Related Issues (20)
- A bug occurred in Swoole-v5.1.1, please report it. HOT 19
- Websocket connection failed. SSL related Issue? HOT 1
- Swoole not supporting partitioned cookie parameter HOT 1
- Can allow_redirects be supported on the HTTP/WebSocket? HOT 7
- Alpine + Swoole + PgSQL on the host = `could not send SSL negotiation packet: Resource temporarily unavailable` HOT 9
- 已解决
- 开启一键协程化之后, `proc_open()` 似乎会受到先前空方法体的 `run(function() {});` 的影响。 HOT 1
- Worker exits without much information HOT 3
- Websocket服務,調用Task做訊息發送,出現session does not exits HOT 5
- \Swoole\Server::shutdown never gets called and signals don't seem to work with \Swoole\Process::signal() / pcntl_signal() HOT 4
- A bug occurred in Swoole-v5.1.2, please report it HOT 14
- PHP Startup Unable to load dynamic library 'swoole' HOT 2
- guzzlehttp在stream=true时,设置超时无效 HOT 5
- 协程被长时间挂起会导致内存大量增加 HOT 49
- windows swoole-cli-v4.8.13-cygwin-x64.zip 在windows上 run(function{}) 内的curl 问题 HOT 2
- 在 Http\Server 中使用 sendfile 在高并发时会导致 PHP 假死 HOT 23
- 🪶 在 C++ 中,有提供了Socket sendfile的方法(zerocopy),可以不通过CPU去调度资源,避免重复拷贝两次DMZ(或者更多) HOT 15
- windows swoole-cli-v4.8.13-cygwin-x64 使用协程监听的Channel数据然后插入数据库,插入没几条就报错了! HOT 4
- syntax error near unexpected token `SQLITE,' HOT 1
- @swoole/library/ext/sockets.php(217) E_DEPRECATED:Creation of dynamic property Swoole\Coroutine\Socket::$__ext_sockets_nonblock is deprecated HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from swoole-src.