ServiceRequest
Index
Constructors
Methods
Constructors
constructor
Returns ServiceRequest
Methods
ack
Acknowledge the request. Used for SEND requests
Returns Promise<void>
a Promise that completes once the ack is sent
body
Get the request body.
Returns Object
the request body
fail
Reply to the request with and error.
Parameters
error: Error
the error to send
Returns Promise<void>
a Promise that completes once the error is sent
notifyOn
Send the topic where the requester should listen to get notifications. Used for OBSERVE requests. The string returned by the Promise is the id of that subscription. It can be used in parallel with the Service.setUnsubscriptionHandler method of the service to execute instructions when a subscription is removed.
Parameters
topic: string
the topic where the client should
Returns Promise<string>
a Promise that completes once the consumer has started to the listen to notifications. The
reply
Send a reply to the request with a content payload. Used for GET requests
Parameters
payload: Object
the payload of the reply
Returns Promise<void>
a Promise that completes once the reply is sent
requestType
Return the type of this Service Request
Returns ServiceRequestType
the type of this request.
userTag
Get the requesting client’s user tag.
Returns Promise<string>
the user tag
A request consumed by a service.