Object -
websub
:
Hub
Object representing a Ballerina WebSub Hub.
Constructor
__init
(string subscriptionUrl, string publishUrl, Listener hubHttpListener)
Methods
Stops the started up Ballerina WebSub Hub.
Publishes an update against the topic in the initialized Ballerina Hub.
Registers a topic in the Ballerina Hub.
Unregisters a topic in the Ballerina Hub.
Removes a subscription from the Ballerina Hub, without verifying intent.
Retrieves topics currently recognized by the Hub.
Retrieves details of subscribers registered to receive updates for a particular topic.
Fields
- subscriptionUrl string
-
The URL for subscription changes
- publishUrl string
-
The URL for publishing and topic registration
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
- payload string | xml | json | byte[] | ReadableByteChannel
-
The update payload
- 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
Registers a topic in the Ballerina Hub.
Parameters
- topic string
-
The topic to register
-
Return Type
(error?) error
if an error occurred with registration
Unregisters a topic in the Ballerina Hub.
Parameters
- topic string
-
The topic to unregister
-
Return Type
(error?) error
if an error occurred with unregistration
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
Retrieves topics currently recognized by the Hub.
-
Return Type
(string[]) An array of available topics
Retrieves details of subscribers registered to receive updates for a particular topic.
Parameters
- topic string
-
The topic for which details need to be retrieved
-
Return Type
(SubscriberDetails[]) An array of subscriber details