Connection.ts 446 Bytes
import { Socket } from "socket.io";
import { MessageHandlerRegister } from "../message/handler/MessageHandlerRegister";
import { User } from "../user/User";

export class Connection {
  public readonly socket: Socket;

  public user?: User;

  constructor(socket: Socket) {
    this.socket = socket;

    MessageHandlerRegister.registerMessageHandlers(this);
  }

  public get authenticated(): boolean {
    return this.user !== undefined;
  }
}