Object -
websub
:
Hub
Represents the Ballerina WebSub Hub.
Constructor
__init
(string subscriptionUrl, string publishUrl, Listener hubHttpListener)
Methods
error? registrationResponse = webSubHub.stop();
error? publishResponse = webSubHub.publishUpdate("http://websubpubtopic.com",{"action": "publish",
"mode": "internal-hub"});
error? registrationResponse = webSubHub.registerTopic("http://websubpubtopic.com");
error? registrationResponse = webSubHub.unregisterTopic("http://websubpubtopic.com");
error? registrationResponse = webSubHub.removeSubscription("http://websubpubtopic.com", "removeSubscriptioCallback");
string[] topic = webSubHub.getAvailableTopics();
string[] topic = webSubHub.getSubscribers("http://websubpubtopic.com");
Fields
- subscriptionUrl string
-
The URL for subscription changes
- publishUrl string
-
The URL for publishing and topic registration
error? registrationResponse = webSubHub.stop();
-
Return Type
(error?) An
error
if hub can't be stoped or else()
publishUpdate
(string topic, string | xml | json | byte[] | ReadableByteChannel payload, string? contentType)
returns error? error? publishResponse = webSubHub.publishUpdate("http://websubpubtopic.com",{"action": "publish",
"mode": "internal-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?) An
error
if the hub is not initialized or does not represent the internal hub or else()
error? registrationResponse = webSubHub.registerTopic("http://websubpubtopic.com");
Parameters
- topic string
-
The topic to register
-
Return Type
(error?) An
error
if an error occurred with registration or else()
error? registrationResponse = webSubHub.unregisterTopic("http://websubpubtopic.com");
Parameters
- topic string
-
The topic to unregister
-
Return Type
(error?) An
error
if an error occurred with unregistration or else()
error? registrationResponse = webSubHub.removeSubscription("http://websubpubtopic.com", "removeSubscriptioCallback");
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?) An
error
if an error occurred with removal or else()
string[] topic = webSubHub.getAvailableTopics();
-
Return Type
(string[]) An array of available topics
string[] topic = webSubHub.getSubscribers("http://websubpubtopic.com");
Parameters
- topic string
-
The topic for which details need to be retrieved
-
Return Type
(SubscriberDetails[]) An array of subscriber details