[英]How can I do right routes and controllers with swoole in laravel?
I installed everything according to the instructions and the project started: 我按照说明安装了所有内容,然后开始了项目:
I read wiki on Github,and on point 7 was this rout example: 我在Github上阅读了Wiki ,第7点是这个溃败示例:
Websocket::on('connect', function ($websocket, Request $request) {
// called while socket on connect
$websocket->emit('message', 'hello world');
});
Websocket::on('disconnect', function ($websocket) {
// called while socket on disconnect
});
Websocket::on('example', function ($websocket, $data) {
$websocket->emit('message', 'response from example action');
});
Websocket::on('message', function ($websocket, $data) {
$websocket->emit('message', 'response from message action');
// $websocket->push('message', 'response from message action by push');
});
Websocket::on('test', 'Users/Telegram@connectServers');
Websocket::on('joinToRoom', 'Users/Telegram@joinToRoom');
Now, when it's connecting (I use this for tests) there is just a message hello word
and every message I used to send, have no answer. 现在,当它连接时(我将其用于测试),只有一个消息
hello word
而我以前发送的每条消息都没有答案。
Why? 为什么?
How can I do right routes and controllers with swoole in laravel ? 如何在Laravel中使用Swoole正确路由和控制器?
Same problem here. 这里同样的问题。 Try to put complete namespace for the controller.
尝试为控制器放置完整的名称空间。
Somthing like: 有点像:
Websocket::on('test', '\App\Http\Controllers\Users\Telegram@connectServers');
It would be great if it worked with the shorted form. 如果可以使用缩写形式,那就太好了。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.