Clients -
websub :
PublisherClient
The HTTP based client for WebSub topic registration and unregistration, and notifying the hub of new updates.
Constructor
__init
(string url, ClientConfiguration? config)
- url string
-
The URL to publish/notify updates to
- config ClientConfiguration? ()
-
The
http:ClientConfiguration
for the underlying client or()
Remote Methods
registerTopic | Registers a topic in a Ballerina WebSub Hub against which subscribers can subscribe and the publisher will publish updates. |
unregisterTopic | Unregisters a topic in a Ballerina WebSub Hub. |
publishUpdate | Publishes an update to a remote Ballerina WebSub Hub. |
notifyUpdate | Notifies a remote WebSub Hub that an update is available to fetch, for hubs that require publishing to happen as such. |
Registers a topic in a Ballerina WebSub Hub against which subscribers can subscribe and the publisher will publish updates.
Parameters
- topic string
-
The topic to register
-
Return Type
(error) error
if an error occurred registering the topic
Unregisters a topic in a Ballerina WebSub Hub.
Parameters
- topic string
-
The topic to unregister
-
Return Type
(error) error
if an error occurred unregistering the topic
publishUpdate
(string topic, string | xml | json | byte | ReadableByteChannel payload, string contentType, map headers)
returns errorPublishes an update to a remote Ballerina WebSub Hub.
Parameters
- topic string
-
The topic for which the update occurred
- payload string | xml | json | byte | ReadableByteChannel
-
The update payload
- contentType string (default ())
-
The type of the update content, to set as the
ContentType
header
- headers map (default ())
-
The headers, if any, that need to be set
-
Return Type
(error) error
if an error occurred with the update
Notifies a remote WebSub Hub that an update is available to fetch, for hubs that require publishing to happen as such.
Parameters
- topic string
-
The topic for which the update occurred
- headers map (default ())
-
The headers, if any, that need to be set
-
Return Type
(error) error
if an error occurred with the notification