Open shafreenAnfar opened 2 years ago
@ayeshLK @chamil321 any thoughts ?
I think as per the current behavior, the ideal code should be something like the below,
import ballerina/websub;
import ballerina/io;
@websub:SubscriberServiceConfig {
target: [
"https://api.github.com/hub",
"https://github.com/<YOUR_ORGANIZATION>/<REPOSITORY>/events/push.json"
],
secret: "<YOUR_SECRET_KEY>",
httpConfig: {
auth: {
token: "<YOUR_AUTH_TOKEN>"
}
}
}
service /JuApTOXq19 on new websub:Listener(9090) {
remote function onEventNotification(
websub:ContentDistributionMessage event) {
worker A returns error? {
var retrievedContent = event.content;
if retrievedContent is json {
// body
} else {
io:println("Unrecognized content type, hence ignoring");
}
}
}
}
I wonder if we should change the default behavior to automatically handle it internally and send 2xx response when the content is received. This can be disabled if the user wants via a configuration.
This seems a good improvement to websub:SubscriberService
.
+1
The spec says
For more information see https://www.w3.org/TR/websub/#content-distribution
I wonder if we should change the default behavior to automatically handle it internally and send 2xx response when the content is received. This can be disabled if the user wants via a configuration.