better port
This commit is contained in:
parent
cc7373f7b3
commit
b4cc092247
|
@ -5,8 +5,9 @@ services:
|
|||
container_name: "web"
|
||||
image: "node"
|
||||
ports:
|
||||
- "6969:80"
|
||||
- "8080:8080"
|
||||
- "6969:6969"
|
||||
- "4242:4242"
|
||||
volumes:
|
||||
- ".:/app"
|
||||
working_dir: "/app"
|
||||
command: "node /app/server.js"
|
||||
|
|
5
load.js
5
load.js
|
@ -1,4 +1,4 @@
|
|||
const connection = new WebSocket('ws://localhost:8080');
|
||||
const connection = new WebSocket('ws://localhost:4242');
|
||||
connection.onmessage = (e) => {
|
||||
var req = JSON.parse(e.data);
|
||||
if (req.name == 'pseudo') {
|
||||
|
@ -35,7 +35,8 @@ window.onload = () => {
|
|||
};
|
||||
}
|
||||
var play = document.getElementById('play');
|
||||
play.onclick = () => {
|
||||
var pseudo = document.getElementById('pseudo');
|
||||
pseudo.onchange = play.onclick = () => {
|
||||
var pseudo = document.getElementById('pseudo').value;
|
||||
connection.send('{"name": "pseudo", "value": "'+pseudo+'"}');
|
||||
};
|
||||
|
|
13
server.js
13
server.js
|
@ -2,9 +2,8 @@ const fs = require('fs');
|
|||
const http = require("http");
|
||||
const ws = require('ws');
|
||||
|
||||
const HTTP_PORT = 80;
|
||||
const WS_PORT = 8080;
|
||||
const DIR = "/app";
|
||||
const HTTP_PORT = 6969;
|
||||
const WS_PORT = 4242;
|
||||
|
||||
function update_player_list()
|
||||
{
|
||||
|
@ -19,28 +18,28 @@ const requestListener = function (req, res) {
|
|||
if (url == "/" || url == "/index.html") {
|
||||
res.setHeader("Content-Type", "text/html");
|
||||
res.writeHead(200);
|
||||
res.end(fs.readFileSync(DIR + "/index.html"));
|
||||
res.end(fs.readFileSync("./index.html"));
|
||||
return;
|
||||
}
|
||||
|
||||
if (url == "/app.wasm") {
|
||||
res.setHeader("Content-Type", "application/wasm");
|
||||
res.writeHead(200);
|
||||
res.end(fs.readFileSync(DIR + url));
|
||||
res.end(fs.readFileSync("." + url));
|
||||
return;
|
||||
}
|
||||
|
||||
if (url == "/load.js") {
|
||||
res.setHeader("Content-Type", "text/javascript");
|
||||
res.writeHead(200);
|
||||
res.end(fs.readFileSync(DIR + url));
|
||||
res.end(fs.readFileSync("." + url));
|
||||
return;
|
||||
}
|
||||
|
||||
if (url.startsWith("/museum/")) {
|
||||
res.setHeader("Content-Type", "image/png");
|
||||
res.writeHead(200);
|
||||
res.end(fs.readFileSync(DIR + url));
|
||||
res.end(fs.readFileSync("." + url));
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue