Created
March 10, 2023 18:29
-
-
Save ayeshLK/40b3e1ba7f793fd14a7cd41e1b716ecf to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
WeatherReport weatherReport = getWeatherReport(location); | |
if weatherReport is error { | |
log:printWarn(string `Error occurred while retrieving weather-report: ${weatherReport.message()}`, stackTrace = weatherReport.stackTrace()); | |
continue; | |
} | |
foreach var [newsReceiverId, clientEp] in newsDispatchClients.entries() { | |
websubhub:ContentDistributionSuccess|error response = clientEp->notifyContentDistribution({ | |
contentType: mime:APPLICATION_JSON, | |
content: { | |
"weather-report": weatherReport.toJson() | |
} | |
}); | |
if response is websubhub:SubscriptionDeletedError { | |
log:printWarn("News receiver responded with subscription-delete response, hence removing", id = newsReceiverId); | |
removeNewsReceiver(newsReceiverId); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment