fixed writing empty board
This commit is contained in:
parent
8d0d75125c
commit
576a88765f
22
src/index.js
22
src/index.js
|
@ -1,4 +1,4 @@
|
|||
const WebSocket = require('ws');
|
||||
const WebSocket = require('wss');
|
||||
const express = require('express');
|
||||
const http = express();
|
||||
const path = require('path');
|
||||
|
@ -25,6 +25,7 @@ var board = new Array(boardWidth * boardHeight * 4);
|
|||
if (!fs.existsSync(saveFile)) {
|
||||
console.log("No save file found, creating blank board.");
|
||||
board.fill(255);
|
||||
let image = new Jimp(boardWidth, boardHeight, save);
|
||||
} else {
|
||||
console.log("Save file found, loading")
|
||||
let image = Jimp.read(`./${saveFile}`, (err, image) => {
|
||||
|
@ -43,13 +44,22 @@ if (!fs.existsSync(saveFile)) {
|
|||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
const server = new WebSocket.Server({
|
||||
port: appPort
|
||||
const ws = new WebSocket.Server({
|
||||
port: appPort,
|
||||
host: "0.0.0.0",
|
||||
handleProtocols: true,
|
||||
server: httpsServer
|
||||
// AddressInfo.family = 4;
|
||||
// server: true
|
||||
});
|
||||
|
||||
// var ws = require('ws').Server;
|
||||
|
||||
// const server = new ws({})
|
||||
console.log(server)
|
||||
|
||||
// const server = new WebSocket.Server({ http });
|
||||
|
||||
let clients = [];
|
||||
let lastPixelTimestamp = [];
|
||||
const evaulatePixelNumber = (x, y) => {
|
||||
|
|
Loading…
Reference in New Issue