added login page

This commit is contained in:
Andrew Gundersen 2021-02-03 19:36:58 -06:00
commit 0f37cf98b1
13 changed files with 148 additions and 203 deletions

44
testServer.js Normal file
View file

@ -0,0 +1,44 @@
const WebSocket = require("ws");
const testMessage = {
content: 'Hello from test server!' ,
context: 'test message',
subContext: '',
modifiers: 'ai',
id: "0",
time: 'test'
}
const wss = new WebSocket.Server({
port: 8080
// perMessageDeflate: {
// zlibDeflateOptions: {
// // See zlib defaults.
// chunkSize: 1024,
// memLevel: 7,
// level: 3
// },
// zlibInflateOptions: {
// chunkSize: 10 * 1024
// },
// // Other options settable:
// clientNoContextTakeover: true, // Defaults to negotiated value.
// serverNoContextTakeover: true, // Defaults to negotiated value.
// serverMaxWindowBits: 10, // Defaults to negotiated value.
// // Below options specified as default values.
// concurrencyLimit: 10, // Limits zlib concurrency for perf.
// threshold: 1024 // Size (in bytes) below which messages
// // should not be compressed.
// }
});
wss.on("connection", function connection(ws, req) {
ws.on("message", function incoming(message) {
console.log(message)
// const parsed = JSON.parse(message)
// console.log(parsed)
});
const ip = req.socket.remoteAddress;
console.log("received connection from", ip);
ws.send(JSON.stringify(testMessage));
});