Add io socket message to share user position.
- Add message 'user-position' to share position in a room. - Change JoinRoomMessage to MessageUserPosition to have all data to share position and user information - Fix error alias to build
This commit is contained in:
parent
63dc515c5b
commit
4e1115725b
6 changed files with 54 additions and 30 deletions
24
back/src/Model/Websocket/MessageUserPosition.ts
Normal file
24
back/src/Model/Websocket/MessageUserPosition.ts
Normal file
|
@ -0,0 +1,24 @@
|
|||
import {Message} from "./Message";
|
||||
|
||||
export class MessageUserPosition extends Message{
|
||||
positionXUser: string;
|
||||
positionYUser: string;
|
||||
|
||||
constructor(message: string) {
|
||||
super(message);
|
||||
let data = JSON.parse(message);
|
||||
this.positionXUser = data.positionXUser;
|
||||
this.positionYUser = data.positionYUser;
|
||||
}
|
||||
|
||||
toString() {
|
||||
return JSON.stringify(
|
||||
Object.assign(
|
||||
super.toJson(),
|
||||
{
|
||||
positionXUser: this.positionXUser,
|
||||
positionYUser: this.positionYUser
|
||||
})
|
||||
);
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue