Problem Statement
I have an application in which the data on the client side (frontend) needs to be updated in near-realtime.
The backend updates a field in the database. There is a GET endpoint which queries the db and sends the data on this db field in response. The client side keeps on polling this GET endpoint in every 2 sec interval due to which there is always a huge traffic on the servers.
I want to replace polling with AWS topics. The server will publish message on the topic and the client will subscribe to these topic and any update data should be shown on client side. I don't want to use the traditional long-polling or websocket approaches and want to solve this via AWS SNS/SQS topics mechanism
Issue
I am not able to understand how to implement this with AWS SNS. As of now, I have created a topic in SNS and want the client to subscribe to this topic for real time updates. To subscribe to SNS, I am thinking to use HTTP/S endpoint which will trigger when message is pushed to topic, but not sure on how client will be able to subscribe to this
- Do I need to create a dummy subscription endpoint on the server side and then client use it. What will be mechanism for client to consume this data ?
(or)
- Do I need to SQS in combination to SNS. SQS will subscribe to SNS topic and then the client will subscribe to SQS queue to get this data ?
Frameworks used if that matters :
- Backend/Server-side (Django)
- Frontend/Client-side (React js)