Creating only one WS connection to pusher from admin
Also: migration to Typescript 4.5 and µWebsockets 1.20.4
This commit is contained in:
parent
4875a8fed9
commit
4cff230256
8 changed files with 206 additions and 87 deletions
30
pusher/src/Model/Websocket/Admin/AdminMessages.ts
Normal file
30
pusher/src/Model/Websocket/Admin/AdminMessages.ts
Normal file
|
@ -0,0 +1,30 @@
|
|||
import * as tg from "generic-type-guard";
|
||||
|
||||
export const isBanBannedAdminMessageInterface = new tg.IsInterface()
|
||||
.withProperties({
|
||||
type: tg.isSingletonStringUnion("ban", "banned"),
|
||||
message: tg.isString,
|
||||
userUuid: tg.isString,
|
||||
})
|
||||
.get();
|
||||
|
||||
export const isUserMessageAdminMessageInterface = new tg.IsInterface()
|
||||
.withProperties({
|
||||
event: tg.isSingletonString("user-message"),
|
||||
message: isBanBannedAdminMessageInterface,
|
||||
world: tg.isString,
|
||||
jwt: tg.isString,
|
||||
})
|
||||
.get();
|
||||
|
||||
export const isListenRoomsMessageInterface = new tg.IsInterface()
|
||||
.withProperties({
|
||||
event: tg.isSingletonString("listen"),
|
||||
roomIds: tg.isArray(tg.isString),
|
||||
jwt: tg.isString,
|
||||
})
|
||||
.get();
|
||||
|
||||
export const isAdminMessageInterface = tg.isUnion(isUserMessageAdminMessageInterface, isListenRoomsMessageInterface);
|
||||
|
||||
export type AdminMessageInterface = tg.GuardedType<typeof isAdminMessageInterface>;
|
Loading…
Add table
Add a link
Reference in a new issue