<?php
declare(strict_types=1);

namespace app\listener\chat;

use app\services\chat\MessageService;
use think\swoole\WebSocket;

/**
 * 发送消息监听器
 */
class ChatMessageSend
{
    private MessageService $messageService;

    public function __construct()
    {
        $this->messageService = new MessageService();
    }

    public function handle(array $data, WebSocket $ws): void
    {
        $this->messageService->sendMessage($ws, $data);
    }
}
