- Create new controller authenticate with login root.. - Update and manage error message socket io. - Create enum for environment variables
20 lines
444 B
TypeScript
20 lines
444 B
TypeScript
export class Message {
|
|
userId: string;
|
|
roomId: string;
|
|
|
|
constructor(message: string) {
|
|
let data = JSON.parse(message);
|
|
if(!data.userId || !data.roomId){
|
|
throw Error("userId and roomId cannot be null");
|
|
}
|
|
this.userId = data.userId;
|
|
this.roomId = data.roomId;
|
|
}
|
|
|
|
toJson() {
|
|
return {
|
|
userId: this.userId,
|
|
roomId: this.roomId,
|
|
}
|
|
}
|
|
} |