Basic message handler

This commit is contained in:
Hri7566 2023-09-07 19:14:44 -04:00
parent 68f445ea03
commit 557df8f972
2 changed files with 8 additions and 0 deletions

0
src/ws/messages/a.ts Normal file
View File

View File

@ -1,5 +1,6 @@
import { App, DEDICATED_COMPRESSOR_8KB } from "uWebSockets.js"; import { App, DEDICATED_COMPRESSOR_8KB } from "uWebSockets.js";
import { Logger } from "../util/Logger"; import { Logger } from "../util/Logger";
import { createUserID } from "../util/id";
const logger = new Logger("WebSocket Server"); const logger = new Logger("WebSocket Server");
@ -11,6 +12,13 @@ export const app = App()
maxPayloadLength: 8192, maxPayloadLength: 8192,
compression: DEDICATED_COMPRESSOR_8KB, compression: DEDICATED_COMPRESSOR_8KB,
open: ws => {
const ip = String(ws.getRemoteAddressAsText());
const _id = createUserID(ip);
logger.debug(ip, _id);
},
message: (ws, message, isBinary) => { message: (ws, message, isBinary) => {
const msg = String(message); const msg = String(message);
logger.debug(msg); logger.debug(msg);