why deepstreamHub? compare us getting started faq
use cases
products
developers
company
blog contact

The entry point for RPCs, both requesting them via make(_:data:) and providing them via provide(_:listener:)

Methods

make(_:name:data:)

class func make(_ rpcName: String, data: Any) -> RpcResult
argument type description
rpcName String The name of the rpc
data Any 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.

Show example...

provide(_:listener:)

class func provide(_ rpcName: String, rpcRequestedListener: RpcRequestedListener) -> Void
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.

Show example...

unprovide(_:)

class func unprovide(_ rpcName: String) -> Void
argument type description
rpcName String The rpcName of the RPC to stop providing

Unregister a RpcRequestedListener registered via Rpc provide(_:listener:)