gen_prop_name receives caller client

This commit is contained in:
Rolands 2026-01-03 15:44:44 +02:00
parent 72f1055404
commit cdb1d2f41e
4 changed files with 5 additions and 5 deletions

View file

@ -467,7 +467,7 @@ export class SocioServer extends LogHandler {
}
// if a name hasnt been supplied, then generate a unique prop name and return it
if (!(data as S_PROP_REG_data)?.prop) {
(data as S_PROP_REG_data).prop = this.lifecycle_hooks.gen_prop_name ? await this.lifecycle_hooks.gen_prop_name() : UUID();
(data as S_PROP_REG_data).prop = this.lifecycle_hooks.gen_prop_name ? await this.lifecycle_hooks.gen_prop_name(client) : UUID();
while (this.#props.has((data as S_PROP_REG_data).prop as PropKey)) (data as S_PROP_REG_data).prop = UUID();
}

View file

@ -1,12 +1,12 @@
{
"name": "socio",
"version": "1.15.2",
"version": "1.15.3",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "socio",
"version": "1.15.2",
"version": "1.15.3",
"license": "MIT",
"dependencies": {
"@msgpack/msgpack": "^3.1.2",

View file

@ -1,6 +1,6 @@
{
"name": "socio",
"version": "1.15.2",
"version": "1.15.3",
"description": "A WebSocket Real-Time Communication (RTC) API framework.",
"main": "./dist/core.js",
"type": "module",

2
core/types.d.ts vendored
View file

@ -45,7 +45,7 @@ type ServerHookDefinitions = {
file_upload?: (caller_client: SocioSession, files?: SocioFiles, data?: any) => Bit | boolean | Promise<Bit | boolean>,
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>,
gen_prop_name?: (caller_client: SocioSession) => string | Promise<string>,
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,