Object - websub : Hub

Object representing a Ballerina WebSub Hub.

Constructor

__init

(string subscriptionUrl, string publishUrl, Listener hubHttpListener)

  • subscriptionUrl string
  • publishUrl string

Methods

Fields

  • subscriptionUrl string
  • The URL for subscription changes

  • publishUrl string
  • The URL for publishing and topic registration

stop

()

returns error

Stops the started up Ballerina WebSub Hub.

  • Return Type

    (error)
  • boolean indicating whether the internal Ballerina Hub was stopped

publishUpdate

(string topic, string | xml | json | byte | ReadableByteChannel payload, string contentType)

returns error

Publishes an update against the topic in the initialized Ballerina Hub.

Parameters

  • topic string
  • The topic for which the update should happen

  • contentType string (default ())
  • The content type header to set for the request delivering the payload

  • Return Type

    (error)
  • error if the hub is not initialized or does not represent the internal hub

registerTopic

(string topic)

returns error

Registers a topic in the Ballerina Hub.

Parameters

  • topic string
  • The topic to register

  • Return Type

    (error)
  • error if an error occurred with registration

unregisterTopic

(string topic)

returns error

Unregisters a topic in the Ballerina Hub.

Parameters

  • topic string
  • The topic to unregister

  • Return Type

    (error)
  • error if an error occurred with unregistration

removeSubscription

(string topic, string callback)

returns error

Removes a subscription from the Ballerina Hub, without verifying intent.

Parameters

  • topic string
  • The topic for which the subscription should be removed

  • callback string
  • The callback for which the subscription should be removed

  • Return Type

    (error)
  • error if an error occurred with removal

getAvailableTopics

()

returns string

Retrieves topics currently recognized by the Hub.

  • Return Type

    (string)
  • An array of available topics

getSubscribers

(string topic)

returns SubscriberDetails[]

Retrieves details of subscribers registered to receive updates for a particular topic.

Parameters

  • topic string
  • The topic for which details need to be retrieved