11 lines
404 B
TypeScript
11 lines
404 B
TypeScript
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"));
|
|
}
|
|
};
|