Skip to content

Instantly share code, notes, and snippets.

@MaryamZi
Created March 24, 2018 05:37
Show Gist options
  • Save MaryamZi/782c00cfed09982559e7210509f26311 to your computer and use it in GitHub Desktop.
Save MaryamZi/782c00cfed09982559e7210509f26311 to your computer and use it in GitHub Desktop.
Sample using Ballerina WebSub Hub client endpoint to unsubscribe.
import ballerina/io;
import ballerina/net.http;
import ballerina/net.websub;
endpoint websub:HubClientEndpoint websubHubClientEP {
uri: "http://localhost:9999/websub/hub"
};
function main (string [] args) {
websub:SubscriptionChangeRequest subscriptionChangeRequest = {topic:"http://www.websubpubtopic.com", callback:"http://localhost:8181/websub"};
var subscriptionChangeResponse = websubHubClientEP -> unsubscribe(subscriptionChangeRequest);
match (subscriptionChangeResponse) {
websub:SubscriptionChangeResponse subs => io:println(“Successful”);
websub:WebSubError err => io:println(“Unsuccessful”);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment