Esben von Buchwald
Esben von Buchwald

Reputation: 3104

Using AWS Lambda to watch SNS topic and deliver by websocket?

For testing/debugging purposes, I would create a web app that emulates the functionality of one of the 3rd party actors in our system. It should be able to publish and subscribe to messages sent on the AWS SNS service.

I was planning to make a ReactJS web app that calls an API made in AWS Lambda. Sending messages should be fine, with some buttons in the app, calling a Lambda that publishes SNS messages to a topic.

But what about monitoring the messages sent to the relevant topics that I want to watch? I was thinking about using a websocket that could receive messages. I know I can trigger a Lambda with SNS messages, but how do I make the lambda deliver these messages to the websocket? is that possible at all without having a permanent server session running? Should I combine with other things in the AWS toolbox?

Upvotes: 10

Views: 9928

Answers (2)

Mark B
Mark B

Reputation: 200672

When I originally wrote this answer websocket support for Lambda was not available, but it is now: https://aws.amazon.com/blogs/compute/announcing-websocket-apis-in-amazon-api-gateway/

Upvotes: 5

Aakash Yadav
Aakash Yadav

Reputation: 615

I was also looking for exact same thing but unfortunately aws sns doesn't have websocket support. But I came across a very interesting blog. So what he has done is using AWS IoT which supports websockets and pub-sub. You can take a look here

Edit : AWS API Gateway gives the functionality to manage Websockets in serverless way. Here is a quick starter guide API Gateway Websockets

Upvotes: 4

Related Questions