Merge branch 'master' of ssh://gitea.frontblock.me:2222/fw-vendor/rpclibrary
This commit is contained in:
@@ -0,0 +1,6 @@
|
|||||||
|
[rpclibrary](README.md) › [Globals](globals.md)
|
||||||
|
|
||||||
|
# rpclibrary
|
||||||
|
|
||||||
|
# Documentation
|
||||||
|
docs [https://gitea.frontblock.me/fw-vendor/rpclibrary/src/branch/master/docs/README.md]
|
||||||
@@ -0,0 +1,166 @@
|
|||||||
|
[rpclibrary](../README.md) › [Globals](../globals.md) › ["Backend"](../modules/_backend_.md) › [RPCServer](_backend_.rpcserver.md)
|
||||||
|
|
||||||
|
# Class: RPCServer <**SubResType**>
|
||||||
|
|
||||||
|
A Websocket-server-on-steroids with built-in RPC capabilities
|
||||||
|
|
||||||
|
## Type parameters
|
||||||
|
|
||||||
|
▪ **SubResType**
|
||||||
|
|
||||||
|
## Hierarchy
|
||||||
|
|
||||||
|
* **RPCServer**
|
||||||
|
|
||||||
|
## Implements
|
||||||
|
|
||||||
|
* [Destroyable](../interfaces/_interfaces_.destroyable.md)
|
||||||
|
|
||||||
|
## Index
|
||||||
|
|
||||||
|
### Constructors
|
||||||
|
|
||||||
|
* [constructor](_backend_.rpcserver.md#constructor)
|
||||||
|
|
||||||
|
### Properties
|
||||||
|
|
||||||
|
* [closeHandler](_backend_.rpcserver.md#private-closehandler)
|
||||||
|
* [connectionHandler](_backend_.rpcserver.md#private-connectionhandler)
|
||||||
|
* [errorHandler](_backend_.rpcserver.md#private-errorhandler)
|
||||||
|
* [exporters](_backend_.rpcserver.md#private-exporters)
|
||||||
|
* [io](_backend_.rpcserver.md#private-io)
|
||||||
|
* [port](_backend_.rpcserver.md#private-port)
|
||||||
|
* [visibility](_backend_.rpcserver.md#private-visibility)
|
||||||
|
* [ws](_backend_.rpcserver.md#private-ws)
|
||||||
|
|
||||||
|
### Methods
|
||||||
|
|
||||||
|
* [destroy](_backend_.rpcserver.md#destroy)
|
||||||
|
* [initRPCs](_backend_.rpcserver.md#protected-initrpcs)
|
||||||
|
* [startWebsocket](_backend_.rpcserver.md#private-startwebsocket)
|
||||||
|
|
||||||
|
## Constructors
|
||||||
|
|
||||||
|
### constructor
|
||||||
|
|
||||||
|
\+ **new RPCServer**(`port`: number, `exporters`: [RPCExporter](../interfaces/_interfaces_.rpcexporter.md)‹SubResType›[], `conf`: T.SocketConf): *[RPCServer](_backend_.rpcserver.md)*
|
||||||
|
|
||||||
|
Defined in Backend.ts:22
|
||||||
|
|
||||||
|
**`throws`** On RPC with no name
|
||||||
|
|
||||||
|
**Parameters:**
|
||||||
|
|
||||||
|
Name | Type | Default | Description |
|
||||||
|
------ | ------ | ------ | ------ |
|
||||||
|
`port` | number | - | The port to listen on |
|
||||||
|
`exporters` | [RPCExporter](../interfaces/_interfaces_.rpcexporter.md)‹SubResType›[] | [] | A list of [RPCExporter](../interfaces/_interfaces_.rpcexporter.md) to publish |
|
||||||
|
`conf` | T.SocketConf | {} | A [SocketConf](../modules/_types_.md#socketconf) object with optional settings |
|
||||||
|
|
||||||
|
**Returns:** *[RPCServer](_backend_.rpcserver.md)*
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
|
||||||
|
### `Private` closeHandler
|
||||||
|
|
||||||
|
• **closeHandler**: *T.CloseHandler*
|
||||||
|
|
||||||
|
Defined in Backend.ts:20
|
||||||
|
|
||||||
|
___
|
||||||
|
|
||||||
|
### `Private` connectionHandler
|
||||||
|
|
||||||
|
• **connectionHandler**: *T.ConnectionHandler*
|
||||||
|
|
||||||
|
Defined in Backend.ts:22
|
||||||
|
|
||||||
|
___
|
||||||
|
|
||||||
|
### `Private` errorHandler
|
||||||
|
|
||||||
|
• **errorHandler**: *T.ErrorHandler*
|
||||||
|
|
||||||
|
Defined in Backend.ts:21
|
||||||
|
|
||||||
|
___
|
||||||
|
|
||||||
|
### `Private` exporters
|
||||||
|
|
||||||
|
• **exporters**: *[RPCExporter](../interfaces/_interfaces_.rpcexporter.md)‹SubResType›[]*
|
||||||
|
|
||||||
|
Defined in Backend.ts:32
|
||||||
|
|
||||||
|
A list of [RPCExporter](../interfaces/_interfaces_.rpcexporter.md) to publish
|
||||||
|
|
||||||
|
___
|
||||||
|
|
||||||
|
### `Private` io
|
||||||
|
|
||||||
|
• **io**: *any* = bsock.createServer()
|
||||||
|
|
||||||
|
Defined in Backend.ts:18
|
||||||
|
|
||||||
|
___
|
||||||
|
|
||||||
|
### `Private` port
|
||||||
|
|
||||||
|
• **port**: *number*
|
||||||
|
|
||||||
|
Defined in Backend.ts:31
|
||||||
|
|
||||||
|
The port to listen on
|
||||||
|
|
||||||
|
___
|
||||||
|
|
||||||
|
### `Private` visibility
|
||||||
|
|
||||||
|
• **visibility**: *T.Visibility*
|
||||||
|
|
||||||
|
Defined in Backend.ts:19
|
||||||
|
|
||||||
|
___
|
||||||
|
|
||||||
|
### `Private` ws
|
||||||
|
|
||||||
|
• **ws**: *Server* = http.createServer()
|
||||||
|
|
||||||
|
Defined in Backend.ts:17
|
||||||
|
|
||||||
|
## Methods
|
||||||
|
|
||||||
|
### destroy
|
||||||
|
|
||||||
|
▸ **destroy**(): *Promise‹void›*
|
||||||
|
|
||||||
|
*Implementation of [Destroyable](../interfaces/_interfaces_.destroyable.md)*
|
||||||
|
|
||||||
|
Defined in Backend.ts:89
|
||||||
|
|
||||||
|
**Returns:** *Promise‹void›*
|
||||||
|
|
||||||
|
___
|
||||||
|
|
||||||
|
### `Protected` initRPCs
|
||||||
|
|
||||||
|
▸ **initRPCs**(`socket`: [Socket](../interfaces/_interfaces_.socket.md)): *void*
|
||||||
|
|
||||||
|
Defined in Backend.ts:82
|
||||||
|
|
||||||
|
**Parameters:**
|
||||||
|
|
||||||
|
Name | Type |
|
||||||
|
------ | ------ |
|
||||||
|
`socket` | [Socket](../interfaces/_interfaces_.socket.md) |
|
||||||
|
|
||||||
|
**Returns:** *void*
|
||||||
|
|
||||||
|
___
|
||||||
|
|
||||||
|
### `Private` startWebsocket
|
||||||
|
|
||||||
|
▸ **startWebsocket**(): *void*
|
||||||
|
|
||||||
|
Defined in Backend.ts:66
|
||||||
|
|
||||||
|
**Returns:** *void*
|
||||||
@@ -0,0 +1,304 @@
|
|||||||
|
[rpclibrary](../README.md) › [Globals](../globals.md) › ["Frontend"](../modules/_frontend_.md) › [RPCSocket](_frontend_.rpcsocket.md)
|
||||||
|
|
||||||
|
# Class: RPCSocket
|
||||||
|
|
||||||
|
A websocket-on-steroids with built-in RPC capabilities
|
||||||
|
|
||||||
|
## Hierarchy
|
||||||
|
|
||||||
|
* **RPCSocket**
|
||||||
|
|
||||||
|
## Implements
|
||||||
|
|
||||||
|
* [Socket](../interfaces/_interfaces_.socket.md)
|
||||||
|
|
||||||
|
## Index
|
||||||
|
|
||||||
|
### Constructors
|
||||||
|
|
||||||
|
* [constructor](_frontend_.rpcsocket.md#constructor)
|
||||||
|
|
||||||
|
### Properties
|
||||||
|
|
||||||
|
* [port](_frontend_.rpcsocket.md#port)
|
||||||
|
* [server](_frontend_.rpcsocket.md#private-server)
|
||||||
|
* [socket](_frontend_.rpcsocket.md#private-socket)
|
||||||
|
* [tls](_frontend_.rpcsocket.md#private-tls)
|
||||||
|
|
||||||
|
### Methods
|
||||||
|
|
||||||
|
* [call](_frontend_.rpcsocket.md#call)
|
||||||
|
* [callGenerator](_frontend_.rpcsocket.md#private-callgenerator)
|
||||||
|
* [close](_frontend_.rpcsocket.md#close)
|
||||||
|
* [connect](_frontend_.rpcsocket.md#connect)
|
||||||
|
* [destroy](_frontend_.rpcsocket.md#destroy)
|
||||||
|
* [fire](_frontend_.rpcsocket.md#fire)
|
||||||
|
* [hook](_frontend_.rpcsocket.md#hook)
|
||||||
|
* [hookGenerator](_frontend_.rpcsocket.md#private-hookgenerator)
|
||||||
|
* [info](_frontend_.rpcsocket.md#info)
|
||||||
|
* [on](_frontend_.rpcsocket.md#on)
|
||||||
|
* [unhook](_frontend_.rpcsocket.md#unhook)
|
||||||
|
|
||||||
|
## Constructors
|
||||||
|
|
||||||
|
### constructor
|
||||||
|
|
||||||
|
\+ **new RPCSocket**(`port`: number, `server`: string, `tls`: boolean): *[RPCSocket](_frontend_.rpcsocket.md)*
|
||||||
|
|
||||||
|
Defined in Frontend.ts:20
|
||||||
|
|
||||||
|
**Parameters:**
|
||||||
|
|
||||||
|
Name | Type | Default | Description |
|
||||||
|
------ | ------ | ------ | ------ |
|
||||||
|
`port` | number | - | Port to connect to |
|
||||||
|
`server` | string | - | Server address |
|
||||||
|
`tls` | boolean | false | @default false use TLS |
|
||||||
|
|
||||||
|
**Returns:** *[RPCSocket](_frontend_.rpcsocket.md)*
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
|
||||||
|
### port
|
||||||
|
|
||||||
|
• **port**: *number*
|
||||||
|
|
||||||
|
*Implementation of [Socket](../interfaces/_interfaces_.socket.md).[port](../interfaces/_interfaces_.socket.md#port)*
|
||||||
|
|
||||||
|
Defined in Frontend.ts:28
|
||||||
|
|
||||||
|
Port to connect to
|
||||||
|
|
||||||
|
___
|
||||||
|
|
||||||
|
### `Private` server
|
||||||
|
|
||||||
|
• **server**: *string*
|
||||||
|
|
||||||
|
Defined in Frontend.ts:28
|
||||||
|
|
||||||
|
Server address
|
||||||
|
|
||||||
|
___
|
||||||
|
|
||||||
|
### `Private` socket
|
||||||
|
|
||||||
|
• **socket**: *[Socket](../interfaces/_interfaces_.socket.md)*
|
||||||
|
|
||||||
|
Defined in Frontend.ts:20
|
||||||
|
|
||||||
|
___
|
||||||
|
|
||||||
|
### `Private` tls
|
||||||
|
|
||||||
|
• **tls**: *boolean*
|
||||||
|
|
||||||
|
Defined in Frontend.ts:28
|
||||||
|
|
||||||
|
@default false use TLS
|
||||||
|
|
||||||
|
## Methods
|
||||||
|
|
||||||
|
### call
|
||||||
|
|
||||||
|
▸ **call**(`rpcname`: T.Name, ...`args`: T.Any[]): *Promise‹T.Any›*
|
||||||
|
|
||||||
|
Defined in Frontend.ts:77
|
||||||
|
|
||||||
|
Trigger a hooked handler on the server
|
||||||
|
|
||||||
|
**Parameters:**
|
||||||
|
|
||||||
|
Name | Type | Description |
|
||||||
|
------ | ------ | ------ |
|
||||||
|
`rpcname` | T.Name | The function to call |
|
||||||
|
`...args` | T.Any[] | other arguments |
|
||||||
|
|
||||||
|
**Returns:** *Promise‹T.Any›*
|
||||||
|
|
||||||
|
___
|
||||||
|
|
||||||
|
### `Private` callGenerator
|
||||||
|
|
||||||
|
▸ **callGenerator**(`fnName`: T.Name, `fnArgs`: T.Arg[]): *T.AsyncFunction*
|
||||||
|
|
||||||
|
Defined in Frontend.ts:126
|
||||||
|
|
||||||
|
Utility [AsyncFunction](../modules/_types_.md#asyncfunction) generator
|
||||||
|
|
||||||
|
**Parameters:**
|
||||||
|
|
||||||
|
Name | Type | Description |
|
||||||
|
------ | ------ | ------ |
|
||||||
|
`fnName` | T.Name | The function name |
|
||||||
|
`fnArgs` | T.Arg[] | A string-list of parameters |
|
||||||
|
|
||||||
|
**Returns:** *T.AsyncFunction*
|
||||||
|
|
||||||
|
___
|
||||||
|
|
||||||
|
### close
|
||||||
|
|
||||||
|
▸ **close**(): *void*
|
||||||
|
|
||||||
|
*Implementation of [Socket](../interfaces/_interfaces_.socket.md)*
|
||||||
|
|
||||||
|
Defined in Frontend.ts:68
|
||||||
|
|
||||||
|
Closes the socket. It may attempt to reconnect.
|
||||||
|
|
||||||
|
**Returns:** *void*
|
||||||
|
|
||||||
|
___
|
||||||
|
|
||||||
|
### connect
|
||||||
|
|
||||||
|
▸ **connect**(): *Promise‹void›*
|
||||||
|
|
||||||
|
Defined in Frontend.ts:93
|
||||||
|
|
||||||
|
Connects to the server and attaches available RPCs to this object
|
||||||
|
|
||||||
|
**Returns:** *Promise‹void›*
|
||||||
|
|
||||||
|
___
|
||||||
|
|
||||||
|
### destroy
|
||||||
|
|
||||||
|
▸ **destroy**(): *void*
|
||||||
|
|
||||||
|
*Implementation of [Socket](../interfaces/_interfaces_.socket.md)*
|
||||||
|
|
||||||
|
Defined in Frontend.ts:61
|
||||||
|
|
||||||
|
Destroys the socket
|
||||||
|
|
||||||
|
**Returns:** *void*
|
||||||
|
|
||||||
|
___
|
||||||
|
|
||||||
|
### fire
|
||||||
|
|
||||||
|
▸ **fire**(`rpcname`: T.Name, ...`args`: T.Any[]): *Promise‹void›*
|
||||||
|
|
||||||
|
Defined in Frontend.ts:86
|
||||||
|
|
||||||
|
An alternative to call that does not wait for confirmation and doesn't return a value.
|
||||||
|
|
||||||
|
**Parameters:**
|
||||||
|
|
||||||
|
Name | Type | Description |
|
||||||
|
------ | ------ | ------ |
|
||||||
|
`rpcname` | T.Name | The function to call |
|
||||||
|
`...args` | T.Any[] | other arguments |
|
||||||
|
|
||||||
|
**Returns:** *Promise‹void›*
|
||||||
|
|
||||||
|
___
|
||||||
|
|
||||||
|
### hook
|
||||||
|
|
||||||
|
▸ **hook**(`name`: T.Name, `handler`: function): *[Socket](../interfaces/_interfaces_.socket.md)*
|
||||||
|
|
||||||
|
Defined in Frontend.ts:37
|
||||||
|
|
||||||
|
Hooks a handler to a function name. Use [call](_frontend_.rpcsocket.md#call) to trigger it.
|
||||||
|
|
||||||
|
**Parameters:**
|
||||||
|
|
||||||
|
▪ **name**: *T.Name*
|
||||||
|
|
||||||
|
The function name to listen on
|
||||||
|
|
||||||
|
▪ **handler**: *function*
|
||||||
|
|
||||||
|
The handler to attach
|
||||||
|
|
||||||
|
▸ (...`args`: any[]): *any | Promise‹any›*
|
||||||
|
|
||||||
|
**Parameters:**
|
||||||
|
|
||||||
|
Name | Type |
|
||||||
|
------ | ------ |
|
||||||
|
`...args` | any[] |
|
||||||
|
|
||||||
|
**Returns:** *[Socket](../interfaces/_interfaces_.socket.md)*
|
||||||
|
|
||||||
|
___
|
||||||
|
|
||||||
|
### `Private` hookGenerator
|
||||||
|
|
||||||
|
▸ **hookGenerator**(`fnName`: T.Name, `fnArgs`: T.Arg[]): *T.HookFunction*
|
||||||
|
|
||||||
|
Defined in Frontend.ts:137
|
||||||
|
|
||||||
|
Utility [HookFunction](../modules/_types_.md#hookfunction) generator
|
||||||
|
|
||||||
|
**Parameters:**
|
||||||
|
|
||||||
|
Name | Type | Description |
|
||||||
|
------ | ------ | ------ |
|
||||||
|
`fnName` | T.Name | The function name |
|
||||||
|
`fnArgs` | T.Arg[] | A string-list of parameters |
|
||||||
|
|
||||||
|
**Returns:** *T.HookFunction*
|
||||||
|
|
||||||
|
___
|
||||||
|
|
||||||
|
### info
|
||||||
|
|
||||||
|
▸ **info**(): *Promise‹any›*
|
||||||
|
|
||||||
|
Defined in Frontend.ts:117
|
||||||
|
|
||||||
|
Get a list of available RPCs from the server
|
||||||
|
|
||||||
|
**Returns:** *Promise‹any›*
|
||||||
|
|
||||||
|
___
|
||||||
|
|
||||||
|
### on
|
||||||
|
|
||||||
|
▸ **on**(`type`: "error" | "close", `f`: function): *[Socket](../interfaces/_interfaces_.socket.md)*
|
||||||
|
|
||||||
|
Defined in Frontend.ts:54
|
||||||
|
|
||||||
|
Attach a listener to error or close events
|
||||||
|
|
||||||
|
**Parameters:**
|
||||||
|
|
||||||
|
▪ **type**: *"error" | "close"*
|
||||||
|
|
||||||
|
'error' or 'close'
|
||||||
|
|
||||||
|
▪ **f**: *function*
|
||||||
|
|
||||||
|
The listener to attach
|
||||||
|
|
||||||
|
▸ (`e?`: any): *void*
|
||||||
|
|
||||||
|
**Parameters:**
|
||||||
|
|
||||||
|
Name | Type |
|
||||||
|
------ | ------ |
|
||||||
|
`e?` | any |
|
||||||
|
|
||||||
|
**Returns:** *[Socket](../interfaces/_interfaces_.socket.md)*
|
||||||
|
|
||||||
|
___
|
||||||
|
|
||||||
|
### unhook
|
||||||
|
|
||||||
|
▸ **unhook**(`name`: T.Name): *[Socket](../interfaces/_interfaces_.socket.md)*
|
||||||
|
|
||||||
|
Defined in Frontend.ts:45
|
||||||
|
|
||||||
|
Removes a [hook](_frontend_.rpcsocket.md#hook) listener by name.
|
||||||
|
|
||||||
|
**Parameters:**
|
||||||
|
|
||||||
|
Name | Type | Description |
|
||||||
|
------ | ------ | ------ |
|
||||||
|
`name` | T.Name | The function name |
|
||||||
|
|
||||||
|
**Returns:** *[Socket](../interfaces/_interfaces_.socket.md)*
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
[rpclibrary](README.md) › [Globals](globals.md)
|
||||||
|
|
||||||
|
# rpclibrary
|
||||||
|
|
||||||
|
## Index
|
||||||
|
|
||||||
|
### External modules
|
||||||
|
|
||||||
|
* ["Backend"](modules/_backend_.md)
|
||||||
|
* ["Frontend"](modules/_frontend_.md)
|
||||||
|
* ["Interfaces"](modules/_interfaces_.md)
|
||||||
|
* ["Types"](modules/_types_.md)
|
||||||
|
* ["Utils"](modules/_utils_.md)
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
[rpclibrary](../README.md) › [Globals](../globals.md) › ["Interfaces"](../modules/_interfaces_.md) › [Destroyable](_interfaces_.destroyable.md)
|
||||||
|
|
||||||
|
# Interface: Destroyable
|
||||||
|
|
||||||
|
## Hierarchy
|
||||||
|
|
||||||
|
* **Destroyable**
|
||||||
|
|
||||||
|
↳ [Socket](_interfaces_.socket.md)
|
||||||
|
|
||||||
|
## Implemented by
|
||||||
|
|
||||||
|
* [RPCServer](../classes/_backend_.rpcserver.md)
|
||||||
|
|
||||||
|
## Index
|
||||||
|
|
||||||
|
### Methods
|
||||||
|
|
||||||
|
* [destroy](_interfaces_.destroyable.md#destroy)
|
||||||
|
|
||||||
|
## Methods
|
||||||
|
|
||||||
|
### destroy
|
||||||
|
|
||||||
|
▸ **destroy**(): *void*
|
||||||
|
|
||||||
|
Defined in Interfaces.ts:26
|
||||||
|
|
||||||
|
**Returns:** *void*
|
||||||
@@ -0,0 +1,41 @@
|
|||||||
|
[rpclibrary](../README.md) › [Globals](../globals.md) › ["Interfaces"](../modules/_interfaces_.md) › [RPCExporter](_interfaces_.rpcexporter.md)
|
||||||
|
|
||||||
|
# Interface: RPCExporter <**T**>
|
||||||
|
|
||||||
|
Interface for all classes that may export RPCs
|
||||||
|
|
||||||
|
## Type parameters
|
||||||
|
|
||||||
|
▪ **T**
|
||||||
|
|
||||||
|
## Hierarchy
|
||||||
|
|
||||||
|
* **RPCExporter**
|
||||||
|
|
||||||
|
## Index
|
||||||
|
|
||||||
|
### Properties
|
||||||
|
|
||||||
|
* [name](_interfaces_.rpcexporter.md#name)
|
||||||
|
|
||||||
|
### Methods
|
||||||
|
|
||||||
|
* [exportRPCs](_interfaces_.rpcexporter.md#exportrpcs)
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
|
||||||
|
### name
|
||||||
|
|
||||||
|
• **name**: *T.Name*
|
||||||
|
|
||||||
|
Defined in Interfaces.ts:8
|
||||||
|
|
||||||
|
## Methods
|
||||||
|
|
||||||
|
### exportRPCs
|
||||||
|
|
||||||
|
▸ **exportRPCs**(): *T.RPC‹T›[]*
|
||||||
|
|
||||||
|
Defined in Interfaces.ts:9
|
||||||
|
|
||||||
|
**Returns:** *T.RPC‹T›[]*
|
||||||
@@ -0,0 +1,151 @@
|
|||||||
|
[rpclibrary](../README.md) › [Globals](../globals.md) › ["Interfaces"](../modules/_interfaces_.md) › [Socket](_interfaces_.socket.md)
|
||||||
|
|
||||||
|
# Interface: Socket
|
||||||
|
|
||||||
|
Generic socket interface that can apply to bsock as well as RPCSocket
|
||||||
|
|
||||||
|
## Hierarchy
|
||||||
|
|
||||||
|
* [Destroyable](_interfaces_.destroyable.md)
|
||||||
|
|
||||||
|
↳ **Socket**
|
||||||
|
|
||||||
|
## Implemented by
|
||||||
|
|
||||||
|
* [RPCSocket](../classes/_frontend_.rpcsocket.md)
|
||||||
|
|
||||||
|
## Index
|
||||||
|
|
||||||
|
### Properties
|
||||||
|
|
||||||
|
* [call](_interfaces_.socket.md#call)
|
||||||
|
* [fire](_interfaces_.socket.md#fire)
|
||||||
|
* [hook](_interfaces_.socket.md#hook)
|
||||||
|
* [on](_interfaces_.socket.md#on)
|
||||||
|
* [port](_interfaces_.socket.md#port)
|
||||||
|
* [unhook](_interfaces_.socket.md#unhook)
|
||||||
|
|
||||||
|
### Methods
|
||||||
|
|
||||||
|
* [close](_interfaces_.socket.md#close)
|
||||||
|
* [destroy](_interfaces_.socket.md#destroy)
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
|
||||||
|
### call
|
||||||
|
|
||||||
|
• **call**: *function*
|
||||||
|
|
||||||
|
Defined in Interfaces.ts:19
|
||||||
|
|
||||||
|
#### Type declaration:
|
||||||
|
|
||||||
|
▸ (`rpcname`: T.Name, ...`args`: T.Any[]): *Promise‹T.Any›*
|
||||||
|
|
||||||
|
**Parameters:**
|
||||||
|
|
||||||
|
Name | Type |
|
||||||
|
------ | ------ |
|
||||||
|
`rpcname` | T.Name |
|
||||||
|
`...args` | T.Any[] |
|
||||||
|
|
||||||
|
___
|
||||||
|
|
||||||
|
### fire
|
||||||
|
|
||||||
|
• **fire**: *function*
|
||||||
|
|
||||||
|
Defined in Interfaces.ts:20
|
||||||
|
|
||||||
|
#### Type declaration:
|
||||||
|
|
||||||
|
▸ (`rpcname`: T.Name, ...`args`: T.Any[]): *Promise‹T.Any›*
|
||||||
|
|
||||||
|
**Parameters:**
|
||||||
|
|
||||||
|
Name | Type |
|
||||||
|
------ | ------ |
|
||||||
|
`rpcname` | T.Name |
|
||||||
|
`...args` | T.Any[] |
|
||||||
|
|
||||||
|
___
|
||||||
|
|
||||||
|
### hook
|
||||||
|
|
||||||
|
• **hook**: *function*
|
||||||
|
|
||||||
|
Defined in Interfaces.ts:17
|
||||||
|
|
||||||
|
#### Type declaration:
|
||||||
|
|
||||||
|
▸ (`rpcname`: T.Name, `handler`: function): *[Socket](_interfaces_.socket.md)*
|
||||||
|
|
||||||
|
**Parameters:**
|
||||||
|
|
||||||
|
▪ **rpcname**: *T.Name*
|
||||||
|
|
||||||
|
▪ **handler**: *function*
|
||||||
|
|
||||||
|
▸ (...`args`: any[]): *any | Promise‹any›*
|
||||||
|
|
||||||
|
**Parameters:**
|
||||||
|
|
||||||
|
Name | Type |
|
||||||
|
------ | ------ |
|
||||||
|
`...args` | any[] |
|
||||||
|
|
||||||
|
___
|
||||||
|
|
||||||
|
### on
|
||||||
|
|
||||||
|
• **on**: *T.OnFunction*
|
||||||
|
|
||||||
|
Defined in Interfaces.ts:21
|
||||||
|
|
||||||
|
___
|
||||||
|
|
||||||
|
### port
|
||||||
|
|
||||||
|
• **port**: *number*
|
||||||
|
|
||||||
|
Defined in Interfaces.ts:16
|
||||||
|
|
||||||
|
___
|
||||||
|
|
||||||
|
### unhook
|
||||||
|
|
||||||
|
• **unhook**: *function*
|
||||||
|
|
||||||
|
Defined in Interfaces.ts:18
|
||||||
|
|
||||||
|
#### Type declaration:
|
||||||
|
|
||||||
|
▸ (`rpcname`: T.Name): *[Socket](_interfaces_.socket.md)*
|
||||||
|
|
||||||
|
**Parameters:**
|
||||||
|
|
||||||
|
Name | Type |
|
||||||
|
------ | ------ |
|
||||||
|
`rpcname` | T.Name |
|
||||||
|
|
||||||
|
## Methods
|
||||||
|
|
||||||
|
### close
|
||||||
|
|
||||||
|
▸ **close**(): *void*
|
||||||
|
|
||||||
|
Defined in Interfaces.ts:22
|
||||||
|
|
||||||
|
**Returns:** *void*
|
||||||
|
|
||||||
|
___
|
||||||
|
|
||||||
|
### destroy
|
||||||
|
|
||||||
|
▸ **destroy**(): *void*
|
||||||
|
|
||||||
|
*Inherited from [Destroyable](_interfaces_.destroyable.md).[destroy](_interfaces_.destroyable.md#destroy)*
|
||||||
|
|
||||||
|
Defined in Interfaces.ts:26
|
||||||
|
|
||||||
|
**Returns:** *void*
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
[rpclibrary](../README.md) › [Globals](../globals.md) › ["Backend"](_backend_.md)
|
||||||
|
|
||||||
|
# External module: "Backend"
|
||||||
|
|
||||||
|
## Index
|
||||||
|
|
||||||
|
### Classes
|
||||||
|
|
||||||
|
* [RPCServer](../classes/_backend_.rpcserver.md)
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
[rpclibrary](../README.md) › [Globals](../globals.md) › ["Frontend"](_frontend_.md)
|
||||||
|
|
||||||
|
# External module: "Frontend"
|
||||||
|
|
||||||
|
## Index
|
||||||
|
|
||||||
|
### Classes
|
||||||
|
|
||||||
|
* [RPCSocket](../classes/_frontend_.rpcsocket.md)
|
||||||
|
|
||||||
|
### Functions
|
||||||
|
|
||||||
|
* [stripAfterEquals](_frontend_.md#stripafterequals)
|
||||||
|
|
||||||
|
## Functions
|
||||||
|
|
||||||
|
### stripAfterEquals
|
||||||
|
|
||||||
|
▸ **stripAfterEquals**(`str`: string): *string*
|
||||||
|
|
||||||
|
Defined in Frontend.ts:12
|
||||||
|
|
||||||
|
Utility function to strip parameters like "a = 3" of their defaults
|
||||||
|
|
||||||
|
**Parameters:**
|
||||||
|
|
||||||
|
Name | Type | Description |
|
||||||
|
------ | ------ | ------ |
|
||||||
|
`str` | string | The parameter to modify |
|
||||||
|
|
||||||
|
**Returns:** *string*
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
[rpclibrary](../README.md) › [Globals](../globals.md) › ["Interfaces"](_interfaces_.md)
|
||||||
|
|
||||||
|
# External module: "Interfaces"
|
||||||
|
|
||||||
|
## Index
|
||||||
|
|
||||||
|
### Interfaces
|
||||||
|
|
||||||
|
* [Destroyable](../interfaces/_interfaces_.destroyable.md)
|
||||||
|
* [RPCExporter](../interfaces/_interfaces_.rpcexporter.md)
|
||||||
|
* [Socket](../interfaces/_interfaces_.socket.md)
|
||||||
@@ -0,0 +1,387 @@
|
|||||||
|
[rpclibrary](../README.md) › [Globals](../globals.md) › ["Types"](_types_.md)
|
||||||
|
|
||||||
|
# External module: "Types"
|
||||||
|
|
||||||
|
## Index
|
||||||
|
|
||||||
|
### Type aliases
|
||||||
|
|
||||||
|
* [Any](_types_.md#any)
|
||||||
|
* [Arg](_types_.md#arg)
|
||||||
|
* [AsyncFunction](_types_.md#asyncfunction)
|
||||||
|
* [BaseInfo](_types_.md#baseinfo)
|
||||||
|
* [CallInfo](_types_.md#callinfo)
|
||||||
|
* [CallRPC](_types_.md#callrpc)
|
||||||
|
* [CallbackFunction](_types_.md#callbackfunction)
|
||||||
|
* [CloseHandler](_types_.md#closehandler)
|
||||||
|
* [ConnectionHandler](_types_.md#connectionhandler)
|
||||||
|
* [ErrorHandler](_types_.md#errorhandler)
|
||||||
|
* [ErrorResponse](_types_.md#errorresponse)
|
||||||
|
* [ExtendedRpcInfo](_types_.md#extendedrpcinfo)
|
||||||
|
* [HookCloseFunction](_types_.md#hookclosefunction)
|
||||||
|
* [HookFunction](_types_.md#hookfunction)
|
||||||
|
* [HookInfo](_types_.md#hookinfo)
|
||||||
|
* [HookRPC](_types_.md#hookrpc)
|
||||||
|
* [Name](_types_.md#name)
|
||||||
|
* [OnFunction](_types_.md#onfunction)
|
||||||
|
* [Outcome](_types_.md#outcome)
|
||||||
|
* [Owner](_types_.md#owner)
|
||||||
|
* [RPC](_types_.md#rpc)
|
||||||
|
* [RPCType](_types_.md#rpctype)
|
||||||
|
* [ResponseType](_types_.md#responsetype)
|
||||||
|
* [Respose](_types_.md#respose)
|
||||||
|
* [RpcInfo](_types_.md#rpcinfo)
|
||||||
|
* [SocketConf](_types_.md#socketconf)
|
||||||
|
* [SubscriptionResponse](_types_.md#subscriptionresponse)
|
||||||
|
* [SuccessResponse](_types_.md#successresponse)
|
||||||
|
* [Visibility](_types_.md#visibility)
|
||||||
|
|
||||||
|
## Type aliases
|
||||||
|
|
||||||
|
### Any
|
||||||
|
|
||||||
|
Ƭ **Any**: *any*
|
||||||
|
|
||||||
|
Defined in Types.ts:4
|
||||||
|
|
||||||
|
___
|
||||||
|
|
||||||
|
### Arg
|
||||||
|
|
||||||
|
Ƭ **Arg**: *string*
|
||||||
|
|
||||||
|
Defined in Types.ts:5
|
||||||
|
|
||||||
|
___
|
||||||
|
|
||||||
|
### AsyncFunction
|
||||||
|
|
||||||
|
Ƭ **AsyncFunction**: *function*
|
||||||
|
|
||||||
|
Defined in Types.ts:65
|
||||||
|
|
||||||
|
#### Type declaration:
|
||||||
|
|
||||||
|
▸ (...`args`: any): *Promise‹any›*
|
||||||
|
|
||||||
|
**Parameters:**
|
||||||
|
|
||||||
|
Name | Type |
|
||||||
|
------ | ------ |
|
||||||
|
`...args` | any |
|
||||||
|
|
||||||
|
___
|
||||||
|
|
||||||
|
### BaseInfo
|
||||||
|
|
||||||
|
Ƭ **BaseInfo**: *object*
|
||||||
|
|
||||||
|
Defined in Types.ts:43
|
||||||
|
|
||||||
|
#### Type declaration:
|
||||||
|
|
||||||
|
* **argNames**: *[Name](_types_.md#name)[]*
|
||||||
|
|
||||||
|
* **name**: *[Name](_types_.md#name)*
|
||||||
|
|
||||||
|
* **owner**: *[Name](_types_.md#name)*
|
||||||
|
|
||||||
|
___
|
||||||
|
|
||||||
|
### CallInfo
|
||||||
|
|
||||||
|
Ƭ **CallInfo**: *[BaseInfo](_types_.md#baseinfo) & object*
|
||||||
|
|
||||||
|
Defined in Types.ts:54
|
||||||
|
|
||||||
|
___
|
||||||
|
|
||||||
|
### CallRPC
|
||||||
|
|
||||||
|
Ƭ **CallRPC**: *object | Function*
|
||||||
|
|
||||||
|
Defined in Types.ts:36
|
||||||
|
|
||||||
|
___
|
||||||
|
|
||||||
|
### CallbackFunction
|
||||||
|
|
||||||
|
Ƭ **CallbackFunction**: *function*
|
||||||
|
|
||||||
|
Defined in Types.ts:66
|
||||||
|
|
||||||
|
#### Type declaration:
|
||||||
|
|
||||||
|
▸ (...`args`: any): *void*
|
||||||
|
|
||||||
|
**Parameters:**
|
||||||
|
|
||||||
|
Name | Type |
|
||||||
|
------ | ------ |
|
||||||
|
`...args` | any |
|
||||||
|
|
||||||
|
___
|
||||||
|
|
||||||
|
### CloseHandler
|
||||||
|
|
||||||
|
Ƭ **CloseHandler**: *function*
|
||||||
|
|
||||||
|
Defined in Types.ts:10
|
||||||
|
|
||||||
|
#### Type declaration:
|
||||||
|
|
||||||
|
▸ (`socket`: [Socket](../interfaces/_interfaces_.socket.md)): *void*
|
||||||
|
|
||||||
|
**Parameters:**
|
||||||
|
|
||||||
|
Name | Type |
|
||||||
|
------ | ------ |
|
||||||
|
`socket` | [Socket](../interfaces/_interfaces_.socket.md) |
|
||||||
|
|
||||||
|
___
|
||||||
|
|
||||||
|
### ConnectionHandler
|
||||||
|
|
||||||
|
Ƭ **ConnectionHandler**: *function*
|
||||||
|
|
||||||
|
Defined in Types.ts:8
|
||||||
|
|
||||||
|
#### Type declaration:
|
||||||
|
|
||||||
|
▸ (`socket`: [Socket](../interfaces/_interfaces_.socket.md)): *void*
|
||||||
|
|
||||||
|
**Parameters:**
|
||||||
|
|
||||||
|
Name | Type |
|
||||||
|
------ | ------ |
|
||||||
|
`socket` | [Socket](../interfaces/_interfaces_.socket.md) |
|
||||||
|
|
||||||
|
___
|
||||||
|
|
||||||
|
### ErrorHandler
|
||||||
|
|
||||||
|
Ƭ **ErrorHandler**: *function*
|
||||||
|
|
||||||
|
Defined in Types.ts:9
|
||||||
|
|
||||||
|
#### Type declaration:
|
||||||
|
|
||||||
|
▸ (`socket`: [Socket](../interfaces/_interfaces_.socket.md), `error`: any): *void*
|
||||||
|
|
||||||
|
**Parameters:**
|
||||||
|
|
||||||
|
Name | Type |
|
||||||
|
------ | ------ |
|
||||||
|
`socket` | [Socket](../interfaces/_interfaces_.socket.md) |
|
||||||
|
`error` | any |
|
||||||
|
|
||||||
|
___
|
||||||
|
|
||||||
|
### ErrorResponse
|
||||||
|
|
||||||
|
Ƭ **ErrorResponse**: *[Respose](_types_.md#respose)‹T› & object*
|
||||||
|
|
||||||
|
Defined in Types.ts:24
|
||||||
|
|
||||||
|
___
|
||||||
|
|
||||||
|
### ExtendedRpcInfo
|
||||||
|
|
||||||
|
Ƭ **ExtendedRpcInfo**: *[RpcInfo](_types_.md#rpcinfo) & object*
|
||||||
|
|
||||||
|
Defined in Types.ts:60
|
||||||
|
|
||||||
|
___
|
||||||
|
|
||||||
|
### HookCloseFunction
|
||||||
|
|
||||||
|
Ƭ **HookCloseFunction**: *function*
|
||||||
|
|
||||||
|
Defined in Types.ts:63
|
||||||
|
|
||||||
|
#### Type declaration:
|
||||||
|
|
||||||
|
▸ (`res`: [SubscriptionResponse](_types_.md#subscriptionresponse)‹T›, `rpc`: [HookRPC](_types_.md#hookrpc)‹T›): *any*
|
||||||
|
|
||||||
|
**Parameters:**
|
||||||
|
|
||||||
|
Name | Type |
|
||||||
|
------ | ------ |
|
||||||
|
`res` | [SubscriptionResponse](_types_.md#subscriptionresponse)‹T› |
|
||||||
|
`rpc` | [HookRPC](_types_.md#hookrpc)‹T› |
|
||||||
|
|
||||||
|
___
|
||||||
|
|
||||||
|
### HookFunction
|
||||||
|
|
||||||
|
Ƭ **HookFunction**: *function*
|
||||||
|
|
||||||
|
Defined in Types.ts:64
|
||||||
|
|
||||||
|
#### Type declaration:
|
||||||
|
|
||||||
|
▸ (...`args`: any): *Promise‹[SubscriptionResponse](_types_.md#subscriptionresponse)‹T› | [ErrorResponse](_types_.md#errorresponse)›*
|
||||||
|
|
||||||
|
**Parameters:**
|
||||||
|
|
||||||
|
Name | Type |
|
||||||
|
------ | ------ |
|
||||||
|
`...args` | any |
|
||||||
|
|
||||||
|
___
|
||||||
|
|
||||||
|
### HookInfo
|
||||||
|
|
||||||
|
Ƭ **HookInfo**: *[BaseInfo](_types_.md#baseinfo) & object*
|
||||||
|
|
||||||
|
Defined in Types.ts:49
|
||||||
|
|
||||||
|
___
|
||||||
|
|
||||||
|
### HookRPC
|
||||||
|
|
||||||
|
Ƭ **HookRPC**: *object*
|
||||||
|
|
||||||
|
Defined in Types.ts:29
|
||||||
|
|
||||||
|
#### Type declaration:
|
||||||
|
|
||||||
|
* **hook**: *[HookFunction](_types_.md#hookfunction)‹T›*
|
||||||
|
|
||||||
|
* **name**: *[Name](_types_.md#name)*
|
||||||
|
|
||||||
|
* **onCallback**? : *[CallbackFunction](_types_.md#callbackfunction)*
|
||||||
|
|
||||||
|
* **onClose**? : *[HookCloseFunction](_types_.md#hookclosefunction)‹T›*
|
||||||
|
|
||||||
|
___
|
||||||
|
|
||||||
|
### Name
|
||||||
|
|
||||||
|
Ƭ **Name**: *[Arg](_types_.md#arg)*
|
||||||
|
|
||||||
|
Defined in Types.ts:6
|
||||||
|
|
||||||
|
___
|
||||||
|
|
||||||
|
### OnFunction
|
||||||
|
|
||||||
|
Ƭ **OnFunction**: *function*
|
||||||
|
|
||||||
|
Defined in Types.ts:62
|
||||||
|
|
||||||
|
#### Type declaration:
|
||||||
|
|
||||||
|
▸ (`type`: "error" | "close", `f`: function): *[Socket](../interfaces/_interfaces_.socket.md)*
|
||||||
|
|
||||||
|
**Parameters:**
|
||||||
|
|
||||||
|
▪ **type**: *"error" | "close"*
|
||||||
|
|
||||||
|
▪ **f**: *function*
|
||||||
|
|
||||||
|
▸ (`e?`: any): *void*
|
||||||
|
|
||||||
|
**Parameters:**
|
||||||
|
|
||||||
|
Name | Type |
|
||||||
|
------ | ------ |
|
||||||
|
`e?` | any |
|
||||||
|
|
||||||
|
___
|
||||||
|
|
||||||
|
### Outcome
|
||||||
|
|
||||||
|
Ƭ **Outcome**: *"Success" | "Error"*
|
||||||
|
|
||||||
|
Defined in Types.ts:19
|
||||||
|
|
||||||
|
___
|
||||||
|
|
||||||
|
### Owner
|
||||||
|
|
||||||
|
Ƭ **Owner**: *[Name](_types_.md#name)*
|
||||||
|
|
||||||
|
Defined in Types.ts:7
|
||||||
|
|
||||||
|
___
|
||||||
|
|
||||||
|
### RPC
|
||||||
|
|
||||||
|
Ƭ **RPC**: *[CallRPC](_types_.md#callrpc) | [HookRPC](_types_.md#hookrpc)‹T›*
|
||||||
|
|
||||||
|
Defined in Types.ts:41
|
||||||
|
|
||||||
|
___
|
||||||
|
|
||||||
|
### RPCType
|
||||||
|
|
||||||
|
Ƭ **RPCType**: *"Hook" | "Unhook" | "Call"*
|
||||||
|
|
||||||
|
Defined in Types.ts:27
|
||||||
|
|
||||||
|
___
|
||||||
|
|
||||||
|
### ResponseType
|
||||||
|
|
||||||
|
Ƭ **ResponseType**: *"Subscribe" | "Success" | "Error"*
|
||||||
|
|
||||||
|
Defined in Types.ts:18
|
||||||
|
|
||||||
|
___
|
||||||
|
|
||||||
|
### Respose
|
||||||
|
|
||||||
|
Ƭ **Respose**: *T & object*
|
||||||
|
|
||||||
|
Defined in Types.ts:22
|
||||||
|
|
||||||
|
___
|
||||||
|
|
||||||
|
### RpcInfo
|
||||||
|
|
||||||
|
Ƭ **RpcInfo**: *[HookInfo](_types_.md#hookinfo) | [CallInfo](_types_.md#callinfo)*
|
||||||
|
|
||||||
|
Defined in Types.ts:59
|
||||||
|
|
||||||
|
___
|
||||||
|
|
||||||
|
### SocketConf
|
||||||
|
|
||||||
|
Ƭ **SocketConf**: *object*
|
||||||
|
|
||||||
|
Defined in Types.ts:11
|
||||||
|
|
||||||
|
#### Type declaration:
|
||||||
|
|
||||||
|
* **closeHandler**? : *[CloseHandler](_types_.md#closehandler)*
|
||||||
|
|
||||||
|
* **connectionHandler**? : *[ConnectionHandler](_types_.md#connectionhandler)*
|
||||||
|
|
||||||
|
* **errorHandler**? : *[ErrorHandler](_types_.md#errorhandler)*
|
||||||
|
|
||||||
|
* **visibility**? : *[Visibility](_types_.md#visibility)*
|
||||||
|
|
||||||
|
___
|
||||||
|
|
||||||
|
### SubscriptionResponse
|
||||||
|
|
||||||
|
Ƭ **SubscriptionResponse**: *[Respose](_types_.md#respose)‹T› & object*
|
||||||
|
|
||||||
|
Defined in Types.ts:25
|
||||||
|
|
||||||
|
___
|
||||||
|
|
||||||
|
### SuccessResponse
|
||||||
|
|
||||||
|
Ƭ **SuccessResponse**: *[Respose](_types_.md#respose)‹T› & object*
|
||||||
|
|
||||||
|
Defined in Types.ts:23
|
||||||
|
|
||||||
|
___
|
||||||
|
|
||||||
|
### Visibility
|
||||||
|
|
||||||
|
Ƭ **Visibility**: *"127.0.0.1" | "0.0.0.0"*
|
||||||
|
|
||||||
|
Defined in Types.ts:3
|
||||||
@@ -0,0 +1,124 @@
|
|||||||
|
[rpclibrary](../README.md) › [Globals](../globals.md) › ["Utils"](_utils_.md)
|
||||||
|
|
||||||
|
# External module: "Utils"
|
||||||
|
|
||||||
|
## Index
|
||||||
|
|
||||||
|
### Functions
|
||||||
|
|
||||||
|
* [extractArgs](_utils_.md#const-extractargs)
|
||||||
|
* [hookGenerator](_utils_.md#const-hookgenerator)
|
||||||
|
* [makeSubResponse](_utils_.md#makesubresponse)
|
||||||
|
* [rpcHooker](_utils_.md#rpchooker)
|
||||||
|
* [rpcToRpcinfo](_utils_.md#const-rpctorpcinfo)
|
||||||
|
|
||||||
|
## Functions
|
||||||
|
|
||||||
|
### `Const` extractArgs
|
||||||
|
|
||||||
|
▸ **extractArgs**(`f`: Function): *T.Arg[]*
|
||||||
|
|
||||||
|
Defined in Utils.ts:110
|
||||||
|
|
||||||
|
Extract a string list of parameters from a function
|
||||||
|
|
||||||
|
**Parameters:**
|
||||||
|
|
||||||
|
Name | Type | Description |
|
||||||
|
------ | ------ | ------ |
|
||||||
|
`f` | Function | The source function |
|
||||||
|
|
||||||
|
**Returns:** *T.Arg[]*
|
||||||
|
|
||||||
|
___
|
||||||
|
|
||||||
|
### `Const` hookGenerator
|
||||||
|
|
||||||
|
▸ **hookGenerator**(`rpc`: T.HookRPC‹any›): *function*
|
||||||
|
|
||||||
|
Defined in Utils.ts:85
|
||||||
|
|
||||||
|
Utility function to generate [HookFunction](_types_.md#hookfunction) from a RPC
|
||||||
|
|
||||||
|
**Parameters:**
|
||||||
|
|
||||||
|
Name | Type | Description |
|
||||||
|
------ | ------ | ------ |
|
||||||
|
`rpc` | T.HookRPC‹any› | The RPC to transform |
|
||||||
|
|
||||||
|
**Returns:** *function*
|
||||||
|
|
||||||
|
A [HookFunction](_types_.md#hookfunction)
|
||||||
|
|
||||||
|
▸ (`socket?`: I.Socket): *[HookFunction](_types_.md#hookfunction)‹T›*
|
||||||
|
|
||||||
|
**Parameters:**
|
||||||
|
|
||||||
|
Name | Type |
|
||||||
|
------ | ------ |
|
||||||
|
`socket?` | I.Socket |
|
||||||
|
|
||||||
|
___
|
||||||
|
|
||||||
|
### makeSubResponse
|
||||||
|
|
||||||
|
▸ **makeSubResponse**(`uuid?`: undefined | string): *[SubscriptionResponse](_types_.md#subscriptionresponse)*
|
||||||
|
|
||||||
|
Defined in Utils.ts:119
|
||||||
|
|
||||||
|
Simple utility function to create basic [SubscriptionResponse](_types_.md#subscriptionresponse)
|
||||||
|
|
||||||
|
**Parameters:**
|
||||||
|
|
||||||
|
Name | Type | Description |
|
||||||
|
------ | ------ | ------ |
|
||||||
|
`uuid?` | undefined | string | optional uuid to use, otherwise defaults to uuid/v4 |
|
||||||
|
|
||||||
|
**Returns:** *[SubscriptionResponse](_types_.md#subscriptionresponse)*
|
||||||
|
|
||||||
|
___
|
||||||
|
|
||||||
|
### rpcHooker
|
||||||
|
|
||||||
|
▸ **rpcHooker**<**SubResT**>(`socket`: [Socket](../interfaces/_interfaces_.socket.md), `exporter`: [RPCExporter](../interfaces/_interfaces_.rpcexporter.md)‹SubResT›, `makeUnique`: boolean): *T.ExtendedRpcInfo[]*
|
||||||
|
|
||||||
|
Defined in Utils.ts:59
|
||||||
|
|
||||||
|
Utility function to apply the RPCs of an [RPCExporter](../interfaces/_interfaces_.rpcexporter.md).
|
||||||
|
|
||||||
|
**Type parameters:**
|
||||||
|
|
||||||
|
▪ **SubResT**
|
||||||
|
|
||||||
|
**Parameters:**
|
||||||
|
|
||||||
|
Name | Type | Default | Description |
|
||||||
|
------ | ------ | ------ | ------ |
|
||||||
|
`socket` | [Socket](../interfaces/_interfaces_.socket.md) | - | The websocket (implementation: bsock) to hook on |
|
||||||
|
`exporter` | [RPCExporter](../interfaces/_interfaces_.rpcexporter.md)‹SubResT› | - | The exporter |
|
||||||
|
`makeUnique` | boolean | true | @default true Attach a suffix to RPC names |
|
||||||
|
|
||||||
|
**Returns:** *T.ExtendedRpcInfo[]*
|
||||||
|
|
||||||
|
___
|
||||||
|
|
||||||
|
### `Const` rpcToRpcinfo
|
||||||
|
|
||||||
|
▸ **rpcToRpcinfo**<**SubResT**>(`rpc`: T.RPC‹SubResT›, `owner`: T.Owner): *T.RpcInfo*
|
||||||
|
|
||||||
|
Defined in Utils.ts:13
|
||||||
|
|
||||||
|
Translate an RPC to RPCInfo for serialization.
|
||||||
|
|
||||||
|
**Type parameters:**
|
||||||
|
|
||||||
|
▪ **SubResT**
|
||||||
|
|
||||||
|
**Parameters:**
|
||||||
|
|
||||||
|
Name | Type | Description |
|
||||||
|
------ | ------ | ------ |
|
||||||
|
`rpc` | T.RPC‹SubResT› | The RPC to transform |
|
||||||
|
`owner` | T.Owner | The owning RPC group's name |
|
||||||
|
|
||||||
|
**Returns:** *T.RpcInfo*
|
||||||
Reference in New Issue
Block a user