|
|
@ -1,18 +1,15 @@
|
|
|
|
//const io = require('socket.io')('http://localhost:3000');
|
|
|
|
//const io = require('socket.io')('http://localhost:3000');
|
|
|
|
const http = require('http');
|
|
|
|
const express = require('express');
|
|
|
|
const io = require('socket.io')('http://82.165.180.114:3000');
|
|
|
|
const socketIO = require('socket.io');//('http://82.165.180.114:3000');
|
|
|
|
|
|
|
|
const app = express();
|
|
|
|
|
|
|
|
const server = app.listen(3000);
|
|
|
|
|
|
|
|
const io=socketIO(server);
|
|
|
|
|
|
|
|
|
|
|
|
const server = http.createServer((req,res) => {
|
|
|
|
io.on('connection', socket => {
|
|
|
|
res.end('Création du serveur');
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const socketServer = io(server);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
socketServer.on('connection', socket => {
|
|
|
|
|
|
|
|
console.log("connection de l'utilisateur à l'id ". socket.id);
|
|
|
|
console.log("connection de l'utilisateur à l'id ". socket.id);
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
socketServer.on('launchGame') , function () {
|
|
|
|
io.on('launchGame') , function () {
|
|
|
|
console.log('launch the game');
|
|
|
|
console.log('launch the game');
|
|
|
|
location.reload();
|
|
|
|
location.reload();
|
|
|
|
}
|
|
|
|
}
|
|
|
|