forked from Hri7566/mpp-server-dev2
Basic message handler
This commit is contained in:
parent
68f445ea03
commit
557df8f972
|
@ -1,5 +1,6 @@
|
|||
import { App, DEDICATED_COMPRESSOR_8KB } from "uWebSockets.js";
|
||||
import { Logger } from "../util/Logger";
|
||||
import { createUserID } from "../util/id";
|
||||
|
||||
const logger = new Logger("WebSocket Server");
|
||||
|
||||
|
@ -11,6 +12,13 @@ export const app = App()
|
|||
maxPayloadLength: 8192,
|
||||
compression: DEDICATED_COMPRESSOR_8KB,
|
||||
|
||||
open: ws => {
|
||||
const ip = String(ws.getRemoteAddressAsText());
|
||||
const _id = createUserID(ip);
|
||||
|
||||
logger.debug(ip, _id);
|
||||
},
|
||||
|
||||
message: (ws, message, isBinary) => {
|
||||
const msg = String(message);
|
||||
logger.debug(msg);
|
||||
|
|
Loading…
Reference in New Issue