Add banned message and close ws

This commit is contained in:
Gregoire Parant 2020-10-20 08:30:11 +02:00
parent 7059c6e6e3
commit eb1f62bb1c

View File

@ -77,16 +77,17 @@ export class IoSocketController {
JSON.parse(new TextDecoder("utf-8").decode(new Uint8Array(arrayBuffer)));
if(message.event === 'user-message') {
if (message.message.type === 'ban') {
const messageToEmit = (message.message as {message: string, type: string, userUuid: string});
const messageToEmit = (message.message as { message: string, type: string, userUuid: string });
switch (message.message.type) {
case 'ban':
socketManager.emitSendUserMessage(messageToEmit);
}
if (message.message.type === 'banned') {
const messageToEmit = (message.message as {message: string, type: string, userUuid: string});
break;
case 'banned':
const socketUser = socketManager.emitSendUserMessage(messageToEmit);
setTimeout(() => {
socketUser.close();
}, 10000);
break;
}
}
}catch (err) {