Client: SubscriptionClient

The HTTP based client for WebSub subscription and unsubscription.

Constructor

Initializes the websub:SubscriptionClient instance.

1websub:SubscriptionClient subscriptionClientEp = check new ("https://sample.hub.com");
init (string url, *ClientConfiguration config)
  • url string
  • The URL at which the subscription should be changed

Remote Methods

subscribe

Sends a subscription request to the provided hub.

unsubscribe

Sends an unsubscription request to a WebSub Hub.

subscribe

function subscribe(SubscriptionChangeRequest subscriptionRequest) returns SubscriptionChangeResponse | SubscriptionInitiationError
Isolated Function
Remote Function

Sends a subscription request to the provided hub.

1websub:SubscriptionChangeResponse response = check subscriberClientEp->subscribe(subscriptionRequest);

Parameters

Return Type

(SubscriptionChangeResponse | SubscriptionInitiationError)

The websub:SubscriptionChangeResponse indicating that the subscription initiation was successful or else an websub:SubscriptionInitiationError

unsubscribe

function unsubscribe(SubscriptionChangeRequest unsubscriptionRequest) returns SubscriptionChangeResponse | SubscriptionInitiationError
Isolated Function
Remote Function

Sends an unsubscription request to a WebSub Hub.

1websub:SubscriptionChangeResponse response = check subscriberClientEp->unsubscribe(subscriptionRequest);

Parameters

Return Type

(SubscriptionChangeResponse | SubscriptionInitiationError)

The websub:SubscriptionChangeResponse indicating that the unsubscription initiation was successful or else an websub:SubscriptionInitiationError