Code cleaning
This commit is contained in:
parent
57adc6b21c
commit
1bbd0866cb
@ -94,10 +94,11 @@ export class IoSocketController {
|
|||||||
x: user x position on map
|
x: user x position on map
|
||||||
y: user y 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 {
|
try {
|
||||||
if (typeof(roomId) !== 'string') {
|
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);
|
let Client = (socket as ExSocketInterface);
|
||||||
@ -124,11 +125,12 @@ export class IoSocketController {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
socket.on(SockerIoEvent.USER_POSITION, (message: any) => {
|
socket.on(SockerIoEvent.USER_POSITION, (message: any): void => {
|
||||||
try {
|
try {
|
||||||
let position = this.hydratePositionReceive(message);
|
let position = this.hydratePositionReceive(message);
|
||||||
if (position instanceof Error) {
|
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);
|
let Client = (socket as ExSocketInterface);
|
||||||
|
@ -36,7 +36,7 @@
|
|||||||
/* Additional Checks */
|
/* Additional Checks */
|
||||||
// "noUnusedLocals": true, /* Report errors on unused locals. */
|
// "noUnusedLocals": true, /* Report errors on unused locals. */
|
||||||
// "noUnusedParameters": true, /* Report errors on unused parameters. */
|
// "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. */
|
// "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */
|
||||||
|
|
||||||
/* Module Resolution Options */
|
/* Module Resolution Options */
|
||||||
|
@ -49,18 +49,12 @@ export class SimplePeer implements SimplePeerInterface{
|
|||||||
});
|
});
|
||||||
|
|
||||||
//receive signal by gemer
|
//receive signal by gemer
|
||||||
this.Connexion.disconnectMessage((message: any) => {
|
this.Connexion.disconnectMessage((data: any) => {
|
||||||
let data = message;
|
|
||||||
this.closeConnexion(data.userId);
|
this.closeConnexion(data.userId);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
private receiveWebrtcStart(data: any) {
|
||||||
*
|
|
||||||
* @param message
|
|
||||||
*/
|
|
||||||
private receiveWebrtcStart(message: any) {
|
|
||||||
let data = message;
|
|
||||||
this.WebRtcRoomId = data.roomId;
|
this.WebRtcRoomId = data.roomId;
|
||||||
this.Users = data.clients;
|
this.Users = data.clients;
|
||||||
|
|
||||||
@ -193,12 +187,7 @@ export class SimplePeer implements SimplePeerInterface{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
private receiveWebrtcSignal(data: any) {
|
||||||
*
|
|
||||||
* @param message
|
|
||||||
*/
|
|
||||||
private receiveWebrtcSignal(message: any) {
|
|
||||||
let data = message;
|
|
||||||
try {
|
try {
|
||||||
//if offer type, create peer connexion
|
//if offer type, create peer connexion
|
||||||
if(data.signal.type === "offer"){
|
if(data.signal.type === "offer"){
|
||||||
|
Loading…
Reference in New Issue
Block a user