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