Members
(inner, constant) ignoreMessages :object
Type:
- object
Methods
(inner) checkAPIresponse(obj, callback, onerror) → {void}
Validates the JSON-RPC API response and calls the callback function
Parameters:
Name | Type | Description |
---|---|---|
obj |
object | parsed json rpc response object |
callback |
function | callback function |
onerror |
boolean | true = execute callback also on error |
Returns:
- Type
- void
(inner) generateJsonrpcId() → {number}
Generates a uniq jsonrpcid, keeping the clientId the same.
Wraps around the requestId.
Returns:
the jsonrpcid
- Type
- number
(inner) getResponseCallback(method) → {function}
Gets the callback for an jsonrpc method.
Used for async jsonrpc responses.
Parameters:
Name | Type | Description |
---|---|---|
method |
string | jsonrpc method |
Returns:
the function that can parse the response, or null
- Type
- function
(inner) sendAPI(method, params, callback, onerror) → {void}
Sends a JSON-RPC API request to the selected partition and handles the response.
Parameters:
Name | Type | Description |
---|---|---|
method |
string | jsonrpc api method |
params |
object | jsonrpc parameters |
callback |
function | callback function |
onerror |
boolean | true = execute callback also on error |
Returns:
- Type
- void
(async, inner) sendAPIpartition(partition, method, params, callback, onerror) → {Promise.<void>}
Sends a JSON-RPC API request and handles the response.
Parameters:
Name | Type | Description |
---|---|---|
partition |
string | partition endpoint |
method |
string | jsonrpc api method |
params |
object | jsonrpc parameters |
callback |
function | callback function |
onerror |
boolean | true = execute callback also on error |
Returns:
- Type
- Promise.<void>
(inner) setJsonRpcError(id, method, error) → {void}
Updates the jsonrpc error object
Parameters:
Name | Type | Description |
---|---|---|
id |
number | jsonrpc id |
method |
string | myMPD api method |
error |
string | the error message |
Returns:
- Type
- void