UNPKG

socio

Version:

A WebSocket Real-Time Communication (RTC) API framework.

18 lines (17 loc) 748 B
import { E } from "./logging.js"; import { SocioClient } from './core-client.js'; import { ServerMessageKind } from './utils.js'; export class AdminClient extends SocioClient { #client_secret = ''; constructor({ client_secret = '', socio_client_opts }) { super(socio_client_opts); if (client_secret.length < 16) throw new E('client_secret length must be at least 16 char for safety. Got ', client_secret.length); this.#client_secret = client_secret; } Run(function_name, ...args) { const { id, prom } = this.CreateQueryPromise(); this.Send(ServerMessageKind.ADMIN, { id: id, client_secret: this.#client_secret, function: function_name, args: args }); return prom; } }