A real-time messaging app uses API Gateway WebSocket APIs with an HTTP backend. The developer must detect a client that repeatedly connects and disconnects and be able to remove that client. Which changes should be made? (Choose two.)
Choose an answer
Tap an option to check your answer.
Correct answer: Add logic in the backend to record client connection status in Amazon ElastiCache., Implement $connect and $disconnect routes in the backend service..
Why this is the answer
To detect and remove a misbehaving client, you need to track connection status and have a mechanism to disconnect them. Implementing $connect and $disconnect routes in the backend service allows you to capture connection and disconnection events. Within these routes, you can add logic to record the client's connection status (e.g., connection ID, timestamp) in a persistent store like Amazon ElastiCache. ElastiCache provides a fast, in-memory data store suitable for tracking real-time connection states. Once a client is identified as problematic, the backend can use the callback URL (provided by API Gateway for WebSocket connections) to terminate the specific client's connection. Migrating to HTTP APIs or REST APIs is incorrect because the requirement is for a real-time messaging app, which typically uses WebSocket APIs for persistent, bidirectional communication. While using the callback URL is part of the solution, it's not one of the two primary changes needed to detect and remove based on repeated connections/disconnections; you first need to track the status and implement the routes.
Pass your exam — without the endless answer hunt
Get every verified question and explanation for this exam in one place, and save hours of prep. 1,000+ certifications · 20+ languages · free to start.
Pass your exam faster → No card needed