Functions - websub

addWebSubLinkHeader

Function to add link headers to a response to allow WebSub discovery.

extractTopicAndHubUrls

Function to retrieve hub and topic URLs from the http:response from a publisher to a discovery request.

startHub

Starts up the Ballerina Hub.

addWebSubLinkHeader

Function to add link headers to a response to allow WebSub discovery.

Parameters

  • response Response
  • The response being sent

  • hubs string[]
  • The hubs the publisher advertises as the hubs that it publishes updates to

  • topic string
  • The topic to which subscribers need to subscribe to, to receive updates for the resource

extractTopicAndHubUrls

(Response response)

returns [string, string[]] | error

Function to retrieve hub and topic URLs from the http:response from a publisher to a discovery request.

Parameters

  • response Response
  • The http:Response received

  • Return Type

    ([string, string[]] | error)
  • (topic, hubs) if parsing and extraction is successful, error if not

startHub

(Listener hubServiceListener, HubConfiguration? hubConfiguration)

returns WebSubHub | HubStartedUpError

Starts up the Ballerina Hub.

Parameters

  • hubServiceListener Listener
  • The http:Listener to which the hub service is attached

  • Return Type

    (WebSubHub | HubStartedUpError)
  • WebSubHub The WebSubHub object representing the newly started up hub, or HubStartedUpError indicating that the hub is already started, and including the WebSubHub object representing the already started up hub