Refactor message
This commit is contained in:
parent
ba9f9dcbe1
commit
7059c6e6e3
@ -81,6 +81,13 @@ export class IoSocketController {
|
||||
const messageToEmit = (message.message as {message: string, type: string, userUuid: string});
|
||||
socketManager.emitSendUserMessage(messageToEmit);
|
||||
}
|
||||
if (message.message.type === 'banned') {
|
||||
const messageToEmit = (message.message as {message: string, type: string, userUuid: string});
|
||||
const socketUser = socketManager.emitSendUserMessage(messageToEmit);
|
||||
setTimeout(() => {
|
||||
socketUser.close();
|
||||
}, 10000);
|
||||
}
|
||||
}
|
||||
}catch (err) {
|
||||
console.error(err);
|
||||
|
@ -673,7 +673,7 @@ class SocketManager {
|
||||
client.send(serverToClientMessage.serializeBinary().buffer, true);
|
||||
}
|
||||
|
||||
public emitSendUserMessage(messageToSend: {userUuid: string, message: string, type: string}): void {
|
||||
public emitSendUserMessage(messageToSend: {userUuid: string, message: string, type: string}): ExSocketInterface {
|
||||
const socket = this.searchClientByUuid(messageToSend.userUuid);
|
||||
if(!socket){
|
||||
throw 'socket was not found';
|
||||
@ -689,6 +689,7 @@ class SocketManager {
|
||||
if (!socket.disconnecting) {
|
||||
socket.send(serverToClientMessage.serializeBinary().buffer, true);
|
||||
}
|
||||
return socket;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
import {TypeMessageInterface} from "./UserMessageManager";
|
||||
import {HtmlUtils} from "../WebRtc/HtmlUtils";
|
||||
|
||||
export class Ban implements TypeMessageInterface {
|
||||
export class TypeMessageExt implements TypeMessageInterface{
|
||||
private nbSecond = 0;
|
||||
private maxNbSecond = 10;
|
||||
private titleMessage = 'IMPORTANT !';
|
||||
@ -60,3 +60,8 @@ export class Ban implements TypeMessageInterface {
|
||||
}
|
||||
}
|
||||
}
|
||||
export class Ban extends TypeMessageExt {
|
||||
}
|
||||
|
||||
export class Banned extends TypeMessageExt {
|
||||
}
|
Loading…
Reference in New Issue
Block a user