Answer the question
In order to leave comments, you need to log in
How to work with Swoole in Laravel?
Does anyone have experience with the Laravel Swoole package ?
I installed everything according to the instructions, the project started:
I read the Wiki on GitHub, and in paragraph 7, an example of routes is given:
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/[email protected]');
Websocket::on('joinToRoom', 'Users/[email protected]');
hello world
, a message will appear, but then, no matter what message I send, nothing comes in response. Why is that? Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question