workadventure/back/src/Model/Websocket/Message.ts
David Négrier 4de552437d Completely getting rid of "userid"
Previously, userid was generated by the "/login" route and passed along.
This commit completely removes the uuid "userid" (and disables the LoginController too and any Jwt check).

"userid" is replaced by the "socket id" of the connection.
So a user is now identified using a socket id, which is unique for a given connection.
2020-05-14 23:20:43 +02:00

28 lines
637 B
TypeScript

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