nerdexam
Amazon

DVA-C02 · Question #637

A real-time messaging application uses Amazon API Gateway WebSocket APIs with backend HTTP service. A developer needs to build a feature in the application to identify a client that keeps connecting t

The correct answer is D. Add code to track the client status in Amazon ElastiCache in the backend service. E. Implement $connect and $disconnect routes in the backend service.. Tracking WebSocket client connection state and enabling forced disconnection requires implementing lifecycle routes and a persistent state store in the backend.

Submitted by dimitri_ru· Mar 5, 2026Development with AWS Services

Question

A real-time messaging application uses Amazon API Gateway WebSocket APIs with backend HTTP service. A developer needs to build a feature in the application to identify a client that keeps connecting to and disconnecting from the WebSocket connection. The developer also needs the ability to remove the client Which combination of changes should the developer make to the application to meet these requirements? (Choose two.)

Options

  • ASwitch to HTTP APIs in the backend service.
  • BSwitch to REST APIs in the backend service.
  • CUse the callback URL to disconnect the client from the backend service.
  • DAdd code to track the client status in Amazon ElastiCache in the backend service.
  • EImplement $connect and $disconnect routes in the backend service.

How the community answered

(49 responses)
  • A
    10% (5)
  • B
    6% (3)
  • C
    2% (1)
  • D
    82% (40)

Why each option

Tracking WebSocket client connection state and enabling forced disconnection requires implementing lifecycle routes and a persistent state store in the backend.

ASwitch to HTTP APIs in the backend service.

Switching to HTTP APIs removes WebSocket support entirely, eliminating the real-time bidirectional messaging capability the application requires.

BSwitch to REST APIs in the backend service.

Switching to REST APIs also removes WebSocket support, making it impossible to maintain persistent connections or receive the $connect and $disconnect events.

CUse the callback URL to disconnect the client from the backend service.

The callback URL is used to send messages to connected clients, not to disconnect them; disconnecting a client from the backend requires a DELETE request to the connection management endpoint.

DAdd code to track the client status in Amazon ElastiCache in the backend service.Correct

Amazon ElastiCache stores connection metadata (connection ID, status, timestamps) in memory, enabling the backend to identify misbehaving clients by detecting repeated connect and disconnect cycles over time.

EImplement $connect and $disconnect routes in the backend service.Correct

Implementing $connect and $disconnect routes captures WebSocket lifecycle events from API Gateway, providing the connection IDs and timestamps needed to track client behavior and trigger disconnection via the connection management API endpoint.

Concept tested: API Gateway WebSocket lifecycle routes and connection state management

Source: https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-websocket-api-route-keys-connect-disconnect.html

Community Discussion

No community discussion yet for this question.

Full DVA-C02 Practice