mirror of
https://github.com/Rolands-Laucis/Socio.git
synced 2026-05-15 06:05:53 -06:00
await some hooks
This commit is contained in:
parent
f9fe6df84f
commit
38d76503a7
2 changed files with 4 additions and 4 deletions
|
|
@ -590,7 +590,7 @@ export class SocioServer extends LogHandler {
|
|||
client.name = name;
|
||||
|
||||
if (this.lifecycle_hooks?.identify)
|
||||
this.lifecycle_hooks.identify(client, name);
|
||||
await this.lifecycle_hooks.identify(client, name);
|
||||
|
||||
client.Send(ClientMessageKind.RES, { id: data.id, result: { success: 1 } });
|
||||
}
|
||||
|
|
@ -601,7 +601,7 @@ export class SocioServer extends LogHandler {
|
|||
if(this.#secure.allow_discovery === true){
|
||||
// let the dev hook handle the discovery logic of what info to get and send from sessions to client
|
||||
if (this.lifecycle_hooks?.discovery)
|
||||
if (this.lifecycle_hooks.discovery(client))
|
||||
if (await this.lifecycle_hooks.discovery(client, data))
|
||||
return;
|
||||
|
||||
// or use my provided basic info response
|
||||
|
|
|
|||
4
core/types.d.ts
vendored
4
core/types.d.ts
vendored
|
|
@ -46,8 +46,8 @@ type ServerHookDefinitions = {
|
|||
file_download?: (caller_client: SocioSession, data: any) => FS_Util_Response | Promise<FS_Util_Response>,
|
||||
endpoint?: (caller_client: SocioSession, endpoint: string) => string | Promise<string>,
|
||||
gen_prop_name?: () => string | Promise<string>,
|
||||
identify?: (caller_client: SocioSession, name: string) => void,
|
||||
discovery?: (caller_client: SocioSession) => { [client_id: string]: { name?: string, ip: string, [key: string]: any } } | any,
|
||||
identify?: (caller_client: SocioSession, name: string) => Promise<void>,
|
||||
discovery?: (caller_client: SocioSession, data: MessageDataObj) => Promise<{ [client_id: string]: { name?: string, ip: string, [key: string]: any } } | any>,
|
||||
rpc?: (target_client: ClientID | string | null, f_name: string, args: any[]) => Promise<any> | any,
|
||||
};
|
||||
// Use a mapped type to define individual importable types. Import this and use like ServerLifecycleHooks['con']
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue