Object - websub : WebSubHub

Object representing a Ballerina WebSub Hub.

Constructor

__init

(string hubUrl, Listener hubHttpListener)

Methods

Fields

  • hubUrl string
  • The URL of the started up Ballerina WebSub Hub

stop

()

returns boolean

Stops the started up Ballerina WebSub Hub.

  • Return Type

    (boolean)
  • 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? - ()
  • 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

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