Langkah 5 dari 12
Membuat Konfigurasi Chat
Buat app/Config/Chat.php. Karena nilai berasal dari .env, pengaturan lokal dan produksi dapat berbeda tanpa mengubah source code:
class Chat extends BaseConfig
{
public string $websocketHost;
public int $websocketPort;
public string $websocketUrl;
public string $allowedOrigin;
public function __construct()
{
parent::__construct();
$this->websocketHost = (string) env('chat.websocketHost', '0.0.0.0');
$this->websocketPort = (int) env('chat.websocketPort', 8081);
$this->websocketUrl = (string) env('chat.websocketUrl', 'ws://localhost:8081');
$this->allowedOrigin = (string) env('chat.allowedOrigin', 'http://localhost:8080');
}
}
