Merge branch 'master' of https://codefirst.iut.uca.fr/git/nathan.boileau/Scripted
continuous-integration/drone/push Build is passing Details

ServeurDeTest
nathan boileau 2 years ago
commit 47890dd216

@ -41,4 +41,5 @@ $vues['doubleElement'] = 'View/src/pages/Enigme/DoubleElement.html';
//Error
$vues['erreur'] = 'View/src/pages/Erreur.php';
$error = "";

@ -206,11 +206,12 @@ class UserController
$model = new UserModel();
$model->addToQueue();
$userGroup = $model->findUserGroup();
echo
'<script>
io.to('.$userGroup.').emit("launchGame");
<script/>';
echo '
<script>
const socket = io();
io.to("'.$userGroup.'").emit("launchGame", {});
</script>
';
} catch (Exception $e) {
$error = $e->getMessage();
require($rep . $vues['erreur']);

@ -26,7 +26,7 @@
</div>
<div class="col-2"></div>
</div>
<form action="index.php?action=login" method="POST">
<form action="index.php?action=signUp" method="POST">
<div class="user-box mb-5 position-relative">
<input type="text" id="username" name="username" required="">
<label>Username</label>

@ -1,8 +1,5 @@
<html>
<body>
<!--script src="/root/node_modules/socket.io"></script-->
<script src="C:\wamp64\www\Scripted\node_modules/socket.io"></script>
<script src="C:\wamp64\www\Scripted\server.js"></script>
vous êtes dans la partie
</body>
</html>

@ -1,8 +1,4 @@
<html>
<body>
</body>
<script src="/root/node_modules/socket.io"></script>
<script src="/var/www/html/Scripted/WEB/server.js"></script>
<!--script src="C:\wamp64\www\Scripted\node_modules/socket.io"></script-->
<!--script src="C:\wamp64\www\Scripted\server.js"></script-->
</html>

@ -1,11 +1,26 @@
//const io = require('socket.io')('http://localhost:3000');
const io = require('socket.io')('http://82.165.180.114:3000');
//modules
module = '/usr/local/lib/node_modules/';
console.log('module');
const express = require(module + "express");
console.log('express');
const socketIO = require(module +"socket.io");//('http://82.165.180.114:3000');
console.log('socketIO');
const app = express();
console.log('app');
const server = app.listen(3000);
const io =socketIO(server);
io.on('connection', socket => {
console.log("connection de l'utilisateur à l'id ". socket.id);
})
console.log('ioOnConnection');
io.on('launchGame') , function () {
io.on('launchGame' , function () {
console.log('launch the game');
location.reload();
}
})
module.exports = {
io : io
};
console.log('iolisten');

1020
package-lock.json generated

File diff suppressed because it is too large Load Diff

@ -4,6 +4,17 @@
"animejs": "^3.2.1",
"bootstrap": "^5.2.2",
"bootstrap-icons": "^1.10.2",
"express": "^4.18.2",
"http": "^0.0.1-security",
"socket.io": "^4.5.4"
},
"nodemonConfig": {
"watch": [
"server.js"
]
},
"scripts": {
"start": "nodemon WEB/server.js"
}
}

Loading…
Cancel
Save