Client: DiscoveryService

Represents resource-discovery service which identify the hub and topic from resource-URL.

Constructor

Initiliazes the websub:DiscoveryService endpoint.

1websub:DiscoveryService discoveryServiceEp = check new ("https://sample.discovery.com");
init (string discoveryUrl, ClientConfiguration? config)

Remote Methods

discoverResourceUrls

Discovers the URLs of the hub and topic defined by a resource URL.

discoverResourceUrls

function discoverResourceUrls(string? | string[ ] expectedMediaTypes, string? | string[ ] expectedLanguageTypes) returns [string, string] | ResourceDiscoveryFailedError
Isolated Function
Remote Function

Discovers the URLs of the hub and topic defined by a resource URL.

1[string, string] discoveryDetails = check discoveryServiceEp->discoverResourceUrls(expectedMediaTypes, expectedLanguageTypes);

Parameters

  • expectedMediaTypes string? | string[ ]
  • The expected media types for the subscriber client

  • expectedLanguageTypes string? | string[ ]
  • The expected language types for the subscriber client

Return Type

([string, string] | ResourceDiscoveryFailedError)

A (hub, topic) as a (string, string) if successful or else an websub:ResourceDiscoveryFailedError if not