You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

globals.md 14KB

Classes

Interfaces

Type aliases

Variables

Functions

Object literals

Type aliases

AccessFilter

Ƭ AccessFilter: function

Type declaration:

▸ (sesame: string | undefined, exporter: I.RPCExporter‹InterfaceT, keyof InterfaceT›): Promise‹boolean› | boolean

Parameters:

Name Type
sesame string | undefined
exporter I.RPCExporter‹InterfaceT, keyof InterfaceT›

AnyFunction

Ƭ AnyFunction: function

Type declaration:

▸ (…args: any): any

Parameters:

Name Type
...args any

AsyncAnyFunction

Ƭ AsyncAnyFunction: AsyncAnyFunction


AsyncIfc

Ƭ AsyncIfc: object

Type declaration:


BaseInfo

Ƭ BaseInfo: object

Type declaration:

  • argNames: string[]

  • name: string

  • owner: string


CallInfo

Ƭ CallInfo: BaseInfo & object


CallRPC

Ƭ CallRPC: object

Type declaration:

  • call: Func

  • name: Name


ClientConfig

Ƭ ClientConfig: ConnectOpts & object


CloseHandler

Ƭ CloseHandler: function

Type declaration:

▸ (socket: Socket): void

Parameters:

Name Type
socket Socket

ConnectedSocket

Ƭ ConnectedSocket: RPCSocket & AsyncIfc‹T›


ConnectionHandler

Ƭ ConnectionHandler: function

Type declaration:

▸ (socket: Socket): void

Parameters:

Name Type
socket Socket

ErrorHandler

Ƭ ErrorHandler: function

Type declaration:

▸ (socket: Socket, error: any, rpcName: string, args: any[]): void

Parameters:

Name Type
socket Socket
error any
rpcName string
args any[]

ErrorResponse

Ƭ ErrorResponse: Respose‹T› & object


ExporterArray

Ƭ ExporterArray: I.RPCExporter‹RPCInterface‹InterfaceT›, keyof InterfaceT›[]


ExtendedRpcInfo

Ƭ ExtendedRpcInfo: RpcInfo & object


FrontEndHandlerType

Ƭ FrontEndHandlerType: object

Type declaration:

  • close(): function

    • (): void
  • error(): function

    • (e: any): void

HookCloseFunction

Ƭ HookCloseFunction: function

Type declaration:

▸ (res: T, rpc: HookRPC‹any, any›): any

Parameters:

Name Type
res T
rpc HookRPC‹any, any›

HookFunction

Ƭ HookFunction: AnyFunction


HookInfo

Ƭ HookInfo: BaseInfo & object


HookRPC

Ƭ HookRPC: object

Type declaration:


OnFunction

Ƭ OnFunction: function

Type declaration:

▸ <T>(type: T, f: FrontEndHandlerType[T]): void

Type parameters:

T: “error” | “close”

Parameters:

Name Type
type T
f FrontEndHandlerType[T]

Outcome

Ƭ Outcome: “Success” | “Error”


PioBindListener

Ƭ PioBindListener: function

Type declaration:

▸ (…args: any): void

Parameters:

Name Type
...args any

PioHookListener

Ƭ PioHookListener: AnyFunction


RPC

Ƭ RPC: HookRPC‹Name, Func› | CallRPC‹Name, Func› | Func


RPCDefinitions

Ƭ RPCDefinitions: object

Type declaration:


RPCExporter

Ƭ RPCExporter: object

Type declaration:

  • RPCs: RPCDefinitions[Name] | function

  • name: Name


RPCInterface

Ƭ RPCInterface: object & Impl


RPCType

Ƭ RPCType: “Hook” | “Unhook” | “Call”


ResponseType

Ƭ ResponseType: “Subscribe” | “Success” | “Error”


Respose

Ƭ Respose: T & object


RpcInfo

Ƭ RpcInfo: HookInfo | CallInfo


ServerConf

Ƭ ServerConf: object & SesameConf


SesameConf

Ƭ SesameConf: object

Type declaration:


SesameFunction

Ƭ SesameFunction: function

Type declaration:

▸ (sesame: string): boolean

Parameters:

Name Type
sesame string

SuccessResponse

Ƭ SuccessResponse: Respose‹T› & object


Visibility

Ƭ Visibility: “127.0.0.1” | “0.0.0.0”


exportT

Ƭ exportT: object

Type declaration:

Variables

Const BAD_CONFIG_PARAM

BAD_CONFIG_PARAM: “RPCServer options were passed to listen(..) after attach(..) was called. Please pass them to attach(..) instead. Ignoring.” = “RPCServer options were passed to listen(..) after attach(..) was called. Please pass them to attach(..) instead. Ignoring.”


Const SOCKET_NOT_CONNECTED

SOCKET_NOT_CONNECTED: “The socket is not connected! Use socket.connect() first” = “The socket is not connected! Use socket.connect() first”


Const UNKNOWN_RPC_IDENTIFIER

UNKNOWN_RPC_IDENTIFIER: ”$UNKNOWNRPC$” = “$UNKNOWNRPC$”

Functions

Const CALL_NOT_FOUND

CALL_NOT_FOUND(callName: any): string

Parameters:

Name Type
callName any

Returns: string


Const RPC_BAD_TYPE

RPC_BAD_TYPE(type: any): string

Parameters:

Name Type
type any

Returns: string


Const RPC_NO_NAME

RPC_NO_NAME(name: any): string

Parameters:

Name Type
name any

Returns: string


Const UNKNOWN_RPC_SERVER

UNKNOWN_RPC_SERVER(name: any): string

Parameters:

Name Type
name any

Returns: string


Const USER_DEFINED_TIMEOUT

USER_DEFINED_TIMEOUT(ms: any): string

Parameters:

Name Type
ms any

Returns: string


appendComma

appendComma(s?: undefined | string, turnToString: boolean): string

Parameters:

Name Type Default
s? undefined | string -
turnToString boolean true

Returns: string


Const callGenerator

callGenerator(rpcName: string, $__socket__$: Socket, rpcFunction: T.AnyFunction, errorHandler: T.ErrorHandler): T.AnyFunction

Parameters:

Name Type Description
rpcName string -
$__socket__$ Socket -
rpcFunction T.AnyFunction the function to decorate
errorHandler T.ErrorHandler -

Returns: T.AnyFunction


Const extractArgs

extractArgs(f: Function): string[]

Parameters:

Name Type Description
f Function The source function

Returns: string[]


fixNames

fixNames(o: Object): void

Parameters:

Name Type
o Object

Returns: void


Const hookGenerator

hookGenerator(rpc: T.HookRPC‹any, any›, errorHandler: T.ErrorHandler, sesameFn?: T.SesameFunction, injectSocket?: undefined | false | true): function

Parameters:

Name Type Description
rpc T.HookRPC‹any, any› The RPC to transform
errorHandler T.ErrorHandler -
sesameFn? T.SesameFunction -
injectSocket? undefined | false | true -

Returns: function

A HookFunction

▸ (socket?: I.Socket): function

Parameters:

Name Type
socket? I.Socket

▸ (…args: any[]): SubresT

Parameters:

Name Type
...args any[]

Const isError

isError(e: any): boolean

Parameters:

Name Type
e any

Returns: boolean


Const makeError

makeError(callName: string): Error

Parameters:

Name Type
callName string

Returns: Error


Const makePioSocket

makePioSocket(socket: any): Socket

Parameters:

Name Type Description
socket any A socket.io socket

Returns: Socket


makeSesameFunction

makeSesameFunction(sesame: T.SesameFunction | string): T.SesameFunction

Parameters:

Name Type
sesame T.SesameFunction | string

Returns: T.SesameFunction


rpcHooker

rpcHooker(socket: Socket, exporter: I.RPCExporter‹any, any›, errorHandler: T.ErrorHandler, sesame?: T.SesameFunction, makeUnique: boolean): T.ExtendedRpcInfo[]

Parameters:

Name Type Default Description
socket Socket - The websocket (implementation: socket.io) to hook on
exporter I.RPCExporter‹any, any› - The exporter
errorHandler T.ErrorHandler - -
sesame? T.SesameFunction - -
makeUnique boolean true @default true Attach a suffix to RPC names

Returns: T.ExtendedRpcInfo[]


Const rpcToRpcinfo

rpcToRpcinfo(socket: Socket, rpc: T.RPC‹any, any›, owner: string, errorHandler: T.ErrorHandler, sesame?: T.SesameFunction): T.RpcInfo

Parameters:

Name Type Description
socket Socket -
rpc T.RPC‹any, any› The RPC to transform
owner string The owning RPC group’s name
errorHandler T.ErrorHandler The error handler to invoke when something goes wrong
sesame? T.SesameFunction optional sesame phrase to prepend before all RPC arguments

Returns: T.RpcInfo


stripAfterEquals

stripAfterEquals(str: string): string

Parameters:

Name Type Description
str string The parameter to modify

Returns: string

Object literals

Const defaultClientConfig

defaultClientConfig: object

callTimeoutMs

callTimeoutMs: number = 0

protocol

protocol: “http” = “http”

reconnection

reconnection: false = false

reconnectionAttempts

reconnectionAttempts: number = 2

reconnectionDelay

reconnectionDelay: number = 200

timeout

timeout: number = 450


Const defaultConfig

defaultConfig: object

cookie

cookie: false = false

path

path: string = “/socket.io”