Object -
websub :
WebSubHub
Object representing a Ballerina WebSub Hub.
Constructor
__init
(string hubUrl, 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.
Retrieves topics currently recognized by the Hub.
Retrieves details of subscribers registered to receive updates for a particular topic.
Fields
- hubUrl string
-
The URL of the started up Ballerina WebSub Hub
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
- payload string | xml | json | byte[] | ReadableByteChannel
-
The update payload
- 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
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
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