Comments (5)
可以呀
from swoole-src.
$this->ws = new Swoole\WebSocket\Server("0.0.0.0", 9061, SWOOLE_PROCESS);
尝试一下实例化的时候加上SWOOLE_PROCESS
from swoole-src.
$this->ws = new Swoole\WebSocket\Server("0.0.0.0", 9061, SWOOLE_PROCESS);
尝试一下实例化的时候加上
SWOOLE_PROCESS
可以了,刚查了文档发现swoole5后预设是 SWOOLE_BASE
非常感谢您
另外想请问
使用swoole websocket来开发多人聊天室(可群聊,可私聊)
将所有onMessage 收到的讯息都一律调用task做逻辑处理
所有push讯息,也只让task处理
这样的设计在swoole适合吗
或是讯息量大的时候,会不会容易造成server崩溃
网上比较少看到其他人这样设计
怕是我对swoole的观念不正确
from swoole-src.
不合理,Task的设计目的是为了执行阻塞代码,不阻塞主进程
from swoole-src.
不合理,Task的设计目的是为了执行阻塞代码,不阻塞主进程
了解
想请问您的建议
在处理群聊讯息的需求下
使用swoole websocket server (实利化使用SWOOLE_PROCESS)
直接透过OnMessage处理逻辑和push广播讯息
并拉高work_num的数量维持效能
如有遇到需要耗时处理的业务,才额外调用task
这样合适吗,是否符合swoole设計的worker和task用意呢
from swoole-src.
Related Issues (20)
- Coroutine\Socket客户端绑定地址失败 HOT 5
- php.ini enable swoole extension composer error : segmentation fault php composer HOT 3
- postgresql在服务端主动断开连接时swoole无法捕获异常 HOT 10
- 5.1.2 Context::parse_multipart_data 导致abort 进程退出 HOT 11
- 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 15
- 已解决
- 开启一键协程化之后, `proc_open()` 似乎会受到先前空方法体的 `run(function() {});` 的影响。 HOT 1
- Worker exits without much information HOT 3
- \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 26
- 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
- 在 Swoole\Coroutine\Http\Server 中的 http server 使用 sendfile 在高并发时会导致 PHP 假死并且内存泄露 HOT 57
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.