|
...
|
...
|
@@ -27,3 +27,13 @@ Websocket::on('example', function ($websocket, $data) { |
|
|
|
@file_put_contents(storage_path('logs/lyh_error.log'), var_export(3333, true) . PHP_EOL, FILE_APPEND);
|
|
|
|
$websocket->emit('message', $data);
|
|
|
|
});
|
|
|
|
|
|
|
|
Websocket::on('message', function ($websocket, $data) {
|
|
|
|
// 处理接收到消息时的逻辑
|
|
|
|
|
|
|
|
// 假设 $data 是客户端发送过来的数据
|
|
|
|
// 在这里您可以根据接收到的消息进行处理
|
|
|
|
|
|
|
|
// 回复消息给客户端
|
|
|
|
$websocket->send("Hello, Client! You sent: $data");
|
|
|
|
}); |
...
|
...
|
|