12345678910111213141516171819202122232425 |
- import * as T from "./Types";
- import * as I from "./Interfaces"
-
- /**
- * Interface for all classes that export RPCs
- */
- export type RPCExporter<
- Ifc extends T.RPCInterface = T.RPCInterface,
- Name extends keyof Ifc = keyof Ifc,
- > = {
- name: Name
- RPCs : T.RPCDefinitions<Ifc>[Name] | (() => T.RPCDefinitions<Ifc>[Name])
- }
-
- export interface Socket {
- id?: string
- bind: (name: string, listener: T.PioBindListener) => void
- hook: (rpcname: string, handler: T.PioHookListener) => void
- unhook: (rpcname: string, listener?:T.AnyFunction) => void
- call: (rpcname: string, ...args: any[]) => Promise<any>
- fire: (rpcname: string, ...args: any[]) => Promise<any>
- on: (type: string, f: T.AnyFunction)=>any
- emit: (eventName: string, data: any) => void
- close(): void
- }
|