add basic socketio to server

This commit is contained in:
Julian Krauser 2025-07-15 11:52:58 +02:00
parent 45ec6b856a
commit b29cdae088
8 changed files with 252 additions and 1 deletions

View file

@ -0,0 +1,11 @@
import { Event, Socket } from "socket.io";
import UnauthorizedRequestException from "../exceptions/unauthorizedRequestException";
import { SocketMap } from "../storage/socketMap";
export default async (socket: Socket, [event, ...args]: Event, next: any) => {
if (SocketMap.exists(socket.id)) {
next();
} else {
next(new UnauthorizedRequestException("not authorized for connection"));
}
};