From f3726312749226a7743b191937c6330c07863d86 Mon Sep 17 00:00:00 2001 From: johan Date: Wed, 4 Jan 2023 13:12:15 +0100 Subject: [PATCH 1/3] changement su chemin du server --- WEB/Config/Config.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/WEB/Config/Config.php b/WEB/Config/Config.php index 700dc2c5..38b6d00c 100644 --- a/WEB/Config/Config.php +++ b/WEB/Config/Config.php @@ -39,7 +39,7 @@ $vues['hanoi'] = 'View/src/pages/Enigme/Hanoi.html'; $vues['trianglePascal'] = 'View/src/pages/Enigme/TrianglePascal.html'; $vues['doubleElement'] = 'View/src/pages/Enigme/DoubleElement.html'; // Server -$server = 'server.js'; +$server = './server.js'; //Error $vues['erreur'] = 'View/src/pages/Erreur.php'; From f826bc8aed42f5b9e3d10cdc1827a602608f5d75 Mon Sep 17 00:00:00 2001 From: johan Date: Wed, 4 Jan 2023 13:19:26 +0100 Subject: [PATCH 2/3] corrections --- WEB/Controller/UserController.php | 4 ++-- WEB/server.js | 7 +++---- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/WEB/Controller/UserController.php b/WEB/Controller/UserController.php index f45dc2c7..d750dd54 100644 --- a/WEB/Controller/UserController.php +++ b/WEB/Controller/UserController.php @@ -8,7 +8,6 @@ class UserController global $dsn, $rep, $vues, $error, $server; $action = $_REQUEST['action']; echo $action; - require $rep . $server; switch ($action) { case NULL: $this->goToHome(); @@ -207,7 +206,8 @@ class UserController $model = new UserModel(); $model->addToQueue(); $userGroup = $model->findUserGroup(); - $io = get_io(); + $server = require 'server.js'; + $io = $server->io; $io->to($userGroup)->emit("launchGame"); } catch (Exception $e) { $error = $e->getMessage(); diff --git a/WEB/server.js b/WEB/server.js index 9622cdac..0ed47547 100644 --- a/WEB/server.js +++ b/WEB/server.js @@ -19,10 +19,9 @@ io.on('launchGame' , function () { console.log('launch the game'); location.reload(); }) + module.exports = { - get_io: function() { - return io; - } - }; + io: io + }; console.log('iolisten'); \ No newline at end of file From d32c77c3eebd1f4d4bf5eb03e44fdfd8407c52b1 Mon Sep 17 00:00:00 2001 From: johan Date: Wed, 4 Jan 2023 13:28:47 +0100 Subject: [PATCH 3/3] test --- WEB/Controller/UserController.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/WEB/Controller/UserController.php b/WEB/Controller/UserController.php index d750dd54..f3fcf447 100644 --- a/WEB/Controller/UserController.php +++ b/WEB/Controller/UserController.php @@ -1,5 +1,5 @@ addToQueue(); $userGroup = $model->findUserGroup(); - $server = require 'server.js'; - $io = $server->io; + $io = get_io(); $io->to($userGroup)->emit("launchGame"); } catch (Exception $e) { $error = $e->getMessage();