refactor tests for readability + linting fixes
This commit is contained in:
parent
9bbabc5038
commit
57fce6d6cc
12 changed files with 123 additions and 318 deletions
20
tests/server.js
Normal file
20
tests/server.js
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
const WebSocket = require("ws");
|
||||
|
||||
const wss = new WebSocket.Server({
|
||||
port: 8081
|
||||
});
|
||||
|
||||
wss.on("connection", function connection(ws, req) {
|
||||
ws.on("message", function incoming(message) {
|
||||
|
||||
console.log(message)
|
||||
if (message === 'no-token' || message === 'undefined') {
|
||||
console.log('no token to authenticate');
|
||||
ws.send('locked');
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
const ip = req.socket.remoteAddress;
|
||||
console.log("received connection from", ip);
|
||||
});
|
||||
Loading…
Reference in a new issue