mirror of
https://github.com/Rolands-Laucis/Socio.git
synced 2026-05-15 06:05:53 -06:00
SERV auto responds with return truthy val
This commit is contained in:
parent
ff936f78aa
commit
c448d876b5
4 changed files with 10 additions and 6 deletions
|
|
@ -498,8 +498,12 @@ export class SocioServer extends LogHandler {
|
|||
break;
|
||||
}
|
||||
case ServerMessageKind.SERV: {
|
||||
if (this.lifecycle_hooks.serv)
|
||||
await this.lifecycle_hooks.serv(client, data);
|
||||
if (this.lifecycle_hooks.serv){
|
||||
const res = await this.lifecycle_hooks.serv(client, data);
|
||||
if (res !== undefined){
|
||||
client.Send(ClientMessageKind.RES, { id: data?.id, result: { success: 1, res } } as C_RES_data);
|
||||
}
|
||||
}
|
||||
else throw new E('Client sent generic data to the server, but the hook for it is not registed. [#no-serv-hook]', client_id);
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
4
core/package-lock.json
generated
4
core/package-lock.json
generated
|
|
@ -1,12 +1,12 @@
|
|||
{
|
||||
"name": "socio",
|
||||
"version": "1.15.5",
|
||||
"version": "1.15.6",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "socio",
|
||||
"version": "1.15.5",
|
||||
"version": "1.15.6",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@msgpack/msgpack": "^3.1.2",
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "socio",
|
||||
"version": "1.15.5",
|
||||
"version": "1.15.6",
|
||||
"description": "A WebSocket Real-Time Communication (RTC) API framework.",
|
||||
"main": "./dist/core.js",
|
||||
"type": "module",
|
||||
|
|
|
|||
2
core/types.d.ts
vendored
2
core/types.d.ts
vendored
|
|
@ -39,7 +39,7 @@ type ServerHookDefinitions = {
|
|||
auth?: (caller_client: SocioSession, params: object | null) => boolean | Promise<boolean>,
|
||||
gen_client_id?: () => ClientID | Promise<ClientID>,
|
||||
grant_perm?: (caller_client: SocioSession, data: GET_PERM_data) => boolean | Promise<boolean>,
|
||||
serv?: (caller_client: SocioSession, data: MessageDataObj) => void | Promise<void>,
|
||||
serv?: (caller_client: SocioSession, data: MessageDataObj) => any | Promise<any>,
|
||||
admin?: (caller_client: SocioSession, data: MessageDataObj) => boolean | Promise<boolean>,
|
||||
blob?: (caller_client: SocioSession, request: Buffer | ArrayBuffer | Buffer[]) => boolean | Promise<boolean>,
|
||||
file_upload?: (caller_client: SocioSession, files?: SocioFiles, data?: any) => Bit | boolean | Promise<Bit | boolean>,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue