Add banned message and close ws
This commit is contained in:
parent
7059c6e6e3
commit
eb1f62bb1c
@ -77,16 +77,17 @@ export class IoSocketController {
|
|||||||
JSON.parse(new TextDecoder("utf-8").decode(new Uint8Array(arrayBuffer)));
|
JSON.parse(new TextDecoder("utf-8").decode(new Uint8Array(arrayBuffer)));
|
||||||
|
|
||||||
if(message.event === 'user-message') {
|
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);
|
socketManager.emitSendUserMessage(messageToEmit);
|
||||||
}
|
break;
|
||||||
if (message.message.type === 'banned') {
|
case 'banned':
|
||||||
const messageToEmit = (message.message as {message: string, type: string, userUuid: string});
|
|
||||||
const socketUser = socketManager.emitSendUserMessage(messageToEmit);
|
const socketUser = socketManager.emitSendUserMessage(messageToEmit);
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
socketUser.close();
|
socketUser.close();
|
||||||
}, 10000);
|
}, 10000);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}catch (err) {
|
}catch (err) {
|
||||||
|
Loading…
Reference in New Issue
Block a user