-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathws-server.php
More file actions
33 lines (28 loc) · 923 Bytes
/
ws-server.php
File metadata and controls
33 lines (28 loc) · 923 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
<?php
/**
* @brief Fichier permettant de lancer le serveur WebSocket
*
* @file ws-server.php
* @author Lucas ESPIET "espiet.l@valbion.com"
* @version 1.0
* @date 2024-12-24
*/
require __DIR__ . '/vendor/autoload.php';
require __DIR__ . '/src/App/Sockets/Chat.php';
require __DIR__ . '/src/App/Sockets/Game.php';
require_once __DIR__ . '/include.php';
use ComusParty\App\Sockets\Chat;
use ComusParty\App\Sockets\Dashboard;
use ComusParty\App\Sockets\Game;
use Ratchet\WebSocket\WsServer;
$allowedOrigins = [
'game.comus-party.com',
'comus-party.com',
'www.comus-party.com',
'localhost',
];
$server = new Ratchet\App('sockets.comus-party.com', 21000);
$server->route('/chat/{token}', new WsServer(new Chat()), $allowedOrigins);
$server->route('/game/{token}', new WsServer(new Game()), $allowedOrigins);
$server->route('/dashboard', new WsServer(new Dashboard()), $allowedOrigins);
$server->run();