|
@@ -2,6 +2,7 @@
|
|
|
|
|
|
namespace App\Console\Commands;
|
|
namespace App\Console\Commands;
|
|
|
|
|
|
|
|
+use Illuminate\Support\Facades\Redis;
|
|
use Ratchet\MessageComponentInterface;
|
|
use Ratchet\MessageComponentInterface;
|
|
use Ratchet\ConnectionInterface;
|
|
use Ratchet\ConnectionInterface;
|
|
use Ratchet\Server\IoServer;
|
|
use Ratchet\Server\IoServer;
|
|
@@ -51,9 +52,9 @@ class WebSocketServer extends Command
|
|
{
|
|
{
|
|
echo "Message from {$from->resourceId}: $msg\n";
|
|
echo "Message from {$from->resourceId}: $msg\n";
|
|
foreach ($this->server->clients as $client) {
|
|
foreach ($this->server->clients as $client) {
|
|
- if ($from !== $client) {
|
|
|
|
- $client->send($msg);
|
|
|
|
- }
|
|
|
|
|
|
+ $queueName = 'log_queue'; // 队列名称
|
|
|
|
+ $logData = Redis::lpop($queueName);
|
|
|
|
+ $client->send($logData);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|