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

This object provides a number of methods that allow a RPC-provider to respond to a request

Methods

ack()

class func ack() -> Void
Acknowledges the receipt of the request. This will happen implicitly unless the request callback explicitly sets autoAck to false

reject()

class func reject() -> Void
Reject the request. This might be necessary if the client is already processing a large number of requests. If deepstream receives a rejection message it will try to route the request to another provider - or return a NO_RPC_PROVIDER error if there are no providers left

send(_:)

class func send(_ data): Any -> Void
argument type description
data Any The response data. Has to be JsonSerializable

Completes the request by sending the response data to the server. If data is an array or object it will automatically be serialised. If autoAck is disabled and the response is sent before the ack message the request will still be completed and the ack message ignored

error(_:)

class func error(_ errorMessage: String) -> Void
argument type description
errorMsg String The message used to describe the error that occured

Notifies deepstream that an error has occured while trying to process the request. This will complete the rpc.