I am doing simple test application in Angular5 which will read notifications coming from Amazon SNS topic and will display it on the UI.
I will publish messages into topic manually. But the problem is How I can subscribe to it from Angular app using aws-sdk.
Thanks!
To subscribe an email address to an Amazon SNS topic using the AWS Management Console. Sign in to the Amazon SNS console . In the left navigation pane, choose Subscriptions. On the Subscriptions page, choose Create subscription.
Amazon CloudWatch uses Amazon SNS to send email. First, create and subscribe to an SNS topic. When you create a CloudWatch alarm, you can add this SNS topic to send an email notification when the alarm changes state.
You should use a webhook or an IOT topic or schedule lambda to do this. Since you are publishing the messages to SNS topic that topic should be subscribed to the so called Lambda function of yours. After that from the application side you have to trigger the lambda function whenever there is a message from the SNS topic. Therefore from the application side we should have a lambda which is scheduled for a specific time(5 minutes) otherwise we would not get triggered when the SNS message data which has been transferred into lambda function.
Instead of using schedule lambda we can use a webhook or IOT topic where we subscribe to it and the lambda which was subscribed to the SNS topic will publish it's data/messages to the webhook or IOT topic. Therefore soon after the publish of data on IOT or webhook, from the application side we always have a subscription to it and we will receive the data in real time.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With