LoginHandler.ts
338 Bytes
import { Connection } from "../../connection/Connection";
import { User } from "../../user/User";
import { LoginMessage } from "../types";
export function loginHandler(
connection: Connection,
message: LoginMessage
): void {
connection.user = new User(message.username);
console.log(`User ${message.username} has logged in!`);
}