server/back/src/Model/Websocket/Message.ts
gparant b65e37c468 Name of map users
- Add name on user
 - Delete NonPlayer class not used
2020-05-03 22:24:14 +02:00

22 lines
No EOL
476 B
TypeScript

export class Message {
userId: string;
roomId: string;
name: string;
constructor(data: any) {
if (!data.userId || !data.roomId) {
throw Error("userId or roomId cannot be null");
}
this.userId = data.userId;
this.roomId = data.roomId;
this.name = data.name;
}
toJson() {
return {
userId: this.userId,
roomId: this.roomId,
name: this.name
}
}
}