x: user x position on map
y: user y position on map
*/
- socket.on(SockerIoEvent.JOIN_ROOM, (roomId: any) => {
+ socket.on(SockerIoEvent.JOIN_ROOM, (roomId: any): void => {
try {
if (typeof(roomId) !== 'string') {
- return socket.emit(SockerIoEvent.MESSAGE_ERROR, {message: 'Expected roomId as a string.'})
+ socket.emit(SockerIoEvent.MESSAGE_ERROR, {message: 'Expected roomId as a string.'});
+ return;
}
let Client = (socket as ExSocketInterface);
}
});
- socket.on(SockerIoEvent.USER_POSITION, (message: any) => {
+ socket.on(SockerIoEvent.USER_POSITION, (message: any): void => {
try {
let position = this.hydratePositionReceive(message);
if (position instanceof Error) {
- return socket.emit(SockerIoEvent.MESSAGE_ERROR, {message: position.message});
+ socket.emit(SockerIoEvent.MESSAGE_ERROR, {message: position.message});
+ return;
}
let Client = (socket as ExSocketInterface);
/* Additional Checks */
// "noUnusedLocals": true, /* Report errors on unused locals. */
// "noUnusedParameters": true, /* Report errors on unused parameters. */
- // "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */
+ "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */
// "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */
/* Module Resolution Options */
});
//receive signal by gemer
- this.Connexion.disconnectMessage((message: any) => {
- let data = message;
+ this.Connexion.disconnectMessage((data: any) => {
this.closeConnexion(data.userId);
});
}
- /**
- *
- * @param message
- */
- private receiveWebrtcStart(message: any) {
- let data = message;
+ private receiveWebrtcStart(data: any) {
this.WebRtcRoomId = data.roomId;
this.Users = data.clients;
}
}
- /**
- *
- * @param message
- */
- private receiveWebrtcSignal(message: any) {
- let data = message;
+ private receiveWebrtcSignal(data: any) {
try {
//if offer type, create peer connexion
if(data.signal.type === "offer"){