Class: PromiseServer

PromiseServer


new PromiseServer()

Constructor for a Jayson Promise Server
Source:
See:
Returns:
Type
PromiseServer

Extends

Methods


_resolveRouter(method, params)

Invoke the router
Parameters:
Name Type Description
method String Method to resolve
params Array | Object Request params
Inherited From:
Source:
Returns:
Type
Method

call(request [, context] [, originalCallback])

Calls a method on the server
Parameters:
Name Type Argument Description
request Object | Array | String A JSON-RPC request object. Object for single request, Array for batches and String for automatic parsing (using the reviver option)
context Object <optional>
Optional context object passed to methods
originalCallback function <optional>
Callback that receives one of two arguments: first is an error and the second a response
Inherited From:
Source:

error( [code] [, message] [, data])

Returns a JSON-RPC compatible error property
Parameters:
Name Type Argument Default Description
code Number <optional>
-32603 Error code
message String <optional>
"Internal error" Error message
data Object <optional>
Additional data that should be provided
Inherited From:
Source:
Returns:
Type
Object

getMethod(name)

Gets a method from the server
Parameters:
Name Type Description
name String
Inherited From:
Source:
Returns:
Type
Method

hasMethod(name)

Checks if a method is registered with the server
Parameters:
Name Type Description
name String Name of method
Inherited From:
Source:
Returns:
Type
Boolean

method(name, definition)

Adds a single method to the server
Parameters:
Name Type Description
name String Name of method to add
definition function | Client Function or Client for a relayed method
Inherited From:
Source:
Throws:
Invalid parameters
Type
TypeError

methods(methods)

Adds a batch of methods to the server
Parameters:
Name Type Description
methods Object Methods to add
Inherited From:
Source:

removeMethod(name)

Removes a method from the server
Parameters:
Name Type Description
name String
Inherited From:
Source: