The entry point for RPCs, both requesting them via make(name,data)
and providing them via provide(name,listener)
Methods
make(name,data)
RpcResult make(String rpcName, Object data)
argument | type | description |
---|---|---|
rpcName | String | The name of the rpc |
data | Object | Serializable data that will be passed to the provider |
Create a remote procedure call. This requires a rpc name for routing, a JSON serializable object for any associated arguments and a callback to notify you with the rpc result or potential error.
provide(name,listener)
void provide(String rpcName, RpcRequestedListener rpcRequestedListener)
argument | type | description |
---|---|---|
rpcName | String | The rpcName of the RPC to provide |
rpcRequestedListener | RpcRequestedListener | The listener to invoke when requests are received |
Registers a RpcRequestedListener
as a RPC provider. If another connected client calls make(name, data)
the request will be routed to the supplied listener.
Only one listener can be registered for a RPC at a time.
Please note: Deepstream tries to deliver data in its original format. Data passed to make(name, data)
as a String will arrive as a String, numbers or implicitly JSON serialized objects will arrive in their respective format as well.
unprovide(name)
void unprovide(String rpcName)
argument | type | description |
---|---|---|
rpcName | String | The rpcName of the RPC to stop providing |
Unregister a RpcRequestedListener
registered via Rpc provide(name,listener)