Skip to main content
Version: 2.2

ServiceRequest

A request consumed by a service.

Index

Constructors

constructor

Methods

ack

  • ack(): Promise<void>
  • Acknowledge the request. Used for SEND requests


    Returns Promise<void>

    a Promise that completes once the ack is sent

body

  • body(): Object
  • Get the request body.


    Returns Object

    the request body

fail

  • fail(error: Error): Promise<void>
  • 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

  • notifyOn(topic: string): Promise<void>
  • Send the topic where the requester should listen to get notifications. Used for OBSERVE requests.


    Parameters

    • topic: string

      the topic where the client should

    Returns Promise<void>

    a Promise that completes once the reply is sent

reply

  • reply(payload: Object): Promise<void>
  • 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

userTag

  • userTag(): Promise<string>
  • Get the requesting client’s user tag.


    Returns Promise<string>

    the user tag