AWS Certified Developer - Associate DVA-C02 Exam QuestionsBrowse all questions from this exam

AWS Certified Developer - Associate DVA-C02 Exam - Question 119


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.)

Show Answer
Correct Answer: DE

To fulfill the requirements, the developer should: 1) Add code to track the client status in Amazon ElastiCache because it provides a fast, in-memory data store that allows the backend service to quickly access and update client status data. This information is crucial for identifying clients with erratic connection patterns. 2) Implement $connect and $disconnect routes because these routes are triggered automatically by API Gateway whenever a client connects or disconnects. This allows the backend service to track and manage client connections and disconnections efficiently.

Discussion

23 comments
Sign in to comment
MrTeeOptions: DE
Apr 23, 2023

Option D because by storing the client status in the cache, the backend service can quickly access the client status data without the need to query the database or perform other time-consuming operations. Option E. Implement $connect and $disconnect routes in the backend service: $connect and $disconnect are the reserved routes in WebSocket APIs, which are automatically called by API Gateway whenever a client connects or disconnects from the WebSocket. By implementing these routes in the backend service, the developer can track and manage the client status, including identifying and removing the client when needed.

akmv2
Mar 28, 2024

How is D viable when the question doesn't mention Elasticache? You're making an assumption that adding a service/configuration is what's being asked

catcatpunchOptions: CE
May 30, 2023

C => https://docs.aws.amazon.com/ko_kr/apigateway/latest/developerguide/apigateway-how-to-call-websocket-api-connections.html E => https://docs.aws.amazon.com/ko_kr/apigateway/latest/developerguide/apigateway-websocket-api-route-keys-connect-disconnect.html

loctongOptions: CE
May 17, 2023

Implementing a callback URL allows the backend service to initiate disconnection from the WebSocket connection.

delakOptions: CE
May 22, 2023

https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-how-to-call-websocket-api-connections.html

PhongsanthOptions: CE
Jun 29, 2023

Option C and E is my preferable choice. why do we have to use option D in case we apply $connect and $disconnect already in option E ? https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-how-to-call-websocket-api-connections.html https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-websocket-api-route-keys-connect-disconnect.html

love777Options: DE
Aug 23, 2023

D. Tracking Client Status: To identify and manage clients that connect and disconnect from the WebSocket connection, you need a way to persist this information. Amazon ElastiCache is a managed in-memory caching service that can be used to store this kind of data. By adding code to your backend service to track client status in ElastiCache, you can keep a record of client connections and disconnections. E. connectanddisconnect Routes: In API Gateway WebSocket APIs, the connectanddisconnect routes are special routes that are automatically triggered when a client connects and disconnects from the WebSocket connection. By implementing these routes in your backend service, you can capture the client information and update the client status in the ElastiCache, thus achieving the requirement of identifying clients and managing their connections.

Balliache520505Options: CE
Sep 13, 2023

I go with C and E. https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-websocket-api-route-keys-connect-disconnect.html https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-how-to-call-websocket-api-connections.html

Ashwinvdm22Options: CD
Jan 31, 2024

C: https://docs.aws.amazon.com/ko_kr/apigateway/latest/developerguide/apigateway-how-to-call-websocket-api-connections.html D: You need a way to track which user is continuously reconnecting. That is why option D is so important because without it you will just be disconnecting every user that tries to connect cause then how will you know which user is the "problem" user. Note that you don't need the $disconnect endpoint to disconnect a client if you use option C. So CD is the only combination to solve the problem.

SerialiDrOptions: DE
Feb 29, 2024

When a client connects to your WebSocket API, the $connect route is invoked, and when they disconnect, the $disconnect route is invoked. You can use these routes to track the state of each client. By maintaining a record of each client's connections and disconnections, possibly in a database or an in-memory data store like Amazon ElastiCache, you can identify clients that frequently connect and disconnect. Hence, the combination of changes that should be made to the application to meet these requirements includes: Implement $connect and $disconnect routes in the backend service (Option E). Add code to track the client status in Amazon ElastiCache in the backend service (Option D).

tsangckl
Jun 17, 2024

This appear at 17 Jun exam

frangesk
Aug 25, 2024

Do you remember the answers?

LR2023Options: CE
Dec 4, 2023

https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-how-to-call-websocket-api-connections.html

a_winOptions: DE
Dec 25, 2023

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.

SerialiDrOptions: CD
Jan 16, 2024

C. Use the callback URL to disconnect the client from the backend service: The callback URL can be used to send messages to connected clients or to disconnect them from the WebSocket connection. This approach allows the backend service to programmatically disconnect a client, which is useful for managing clients that frequently connect and disconnect. D. Add code to track the client status in Amazon ElastiCache in the backend service: Implementing client status tracking in the backend service, possibly using a fast, in-memory data store like Amazon ElastiCache, allows the application to monitor and record the behavior of each client. This can be used to identify clients with frequent connect/disconnect patterns.

Abdullah22
Jan 21, 2024

going with DE

KarBiswaOptions: CE
Feb 25, 2024

C option - Supports https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-how-to-call-websocket-api-connections.html E option supports - https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-websocket-api-route-keys-connect-disconnect.html

maurice2005Options: CE
Mar 15, 2024

Your backend service can use the following WebSocket connection HTTP requests to send a callback message to a connected client, get connection information, or disconnect the client https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-how-to-call-websocket-api-connections.html

41eb566Options: DE
Mar 17, 2024

E. Implement $connect and $disconnect routes in the backend service. By implementing $connect and $disconnect routes, the backend service can capture when clients connect and disconnect from the WebSocket connection. This allows the application to track client status effectively. D. Add code to track the client status in Amazon ElastiCache in the backend service.

65703c1Options: DE
May 23, 2024

DE is the correct answer.

tomchandler077
Jul 17, 2024

Option D ---> CORRECT Because, tracking the client's connection status using ElastiCache could help in identifying clients with erratic connection patterns and managing stateful information in a distributed environment, which is useful for WebSocket applications. Also Option E CORRECT. These routes handle connection and disconnection events.

Saurabh04
Aug 7, 2024

Option DE: Implement $connect and $disconnect Routes: Add $connect and $disconnect routes to your WebSocket API. These routes handle client connections and disconnections. When a client connects ($connect), a Lambda function can add the connection ID to a data store (e.g., DynamoDB). When a client disconnects ($disconnect), another Lambda function can remove the connection ID from the data store. Track Client Status: Use Amazon ElastiCache (e.g., Redis) to track client status. Store relevant information (e.g., client IDs, connection timestamps) in ElastiCache. This allows you to identify clients that connect and disconnect

9d8dd9c
Oct 26, 2024

What about "the ability to remove the client"? for that it needs to use the callback function

sumanshuOptions: DE
Dec 28, 2024

A) Eliminated - Switching to HTTP APIs would eliminate the WebSocket capability entirely, B) Eliminated - REST APIs are also unsuitable for WebSocket connections, as they are designed for request-response interactions rather than persistent, real-time communication. Both C&E and D&E - seems correct C) - API Gateway provides a callback URL that your backend service can use to invoke the POST /connections/{connectionId} API with the disconnect command. D) E) Correct - The $connect route triggers when a client establishes a WebSocket connection. The $disconnect route triggers when a client disconnects from the WebSocket

sumanshu
Dec 28, 2024

C) Callback URL allows you to explicitly disconnect clients.

sumanshu
Dec 28, 2024

The two requirements in the question are: Identify a client that keeps connecting and disconnecting: This requires tracking client connections and disconnections over time. To achieve this, the backend needs a mechanism to log or store connection events for each client, which can then be analyzed to identify repeated connection patterns. Remove the client: Once the client is identified as problematic (e.g., frequent connects/disconnects), the backend needs to remove the client. This is achieved using the WebSocket callback URL to explicitly disconnect the client.

sumanshu
Dec 28, 2024

D is critical for tracking client activity. E is required to capture connection and disconnection events. C provides the functionality to disconnect a client once identified. Thus, the correct combination is C, D, and E.

sumanshu
Dec 28, 2024

C. Use the callback URL to disconnect the client from the backend service This is essential for removing the client. Without it, the backend has no way to forcibly disconnect a problematic client. ✅ Must-have. D. Add code to track the client status in Amazon ElastiCache in the backend service Tracking client connection/disconnection behavior is critical to identifying problematic clients. ElastiCache is a highly suitable tool for storing connection data efficiently. ✅ Must-have. E. Implement $connect and $disconnect routes in the backend service While these routes are necessary for detecting client connections and disconnections, this could be seen as implicit in the implementation of D (since tracking client status assumes these routes are already used). ⚠️ Optional, depending on how the question is interpreted.

sumanshu
Dec 28, 2024

C. Use the callback URL to disconnect the client from the backend service This is essential for removing the client. Without it, the backend has no way to forcibly disconnect a problematic client. ✅ Must-have. D. Add code to track the client status in Amazon ElastiCache in the backend service Tracking client connection/disconnection behavior is critical to identifying problematic clients. ElastiCache is a highly suitable tool for storing connection data efficiently. ✅ Must-have. E. Implement $connect and $disconnect routes in the backend service While these routes are necessary for detecting client connections and disconnections, this could be seen as implicit in the implementation of D (since tracking client status assumes these routes are already used). ⚠️ Optional, depending on how the question is interpreted.

sumanshu
Dec 28, 2024

D is critical for tracking client activity. E is required to capture connection and disconnection events. C provides the functionality to disconnect a client once identified. Thus, the correct combination is C, D, and E.

sumanshu
Dec 28, 2024

C. Use the callback URL to disconnect the client from the backend service This is essential for removing the client. Without it, the backend has no way to forcibly disconnect a problematic client. ✅ Must-have. D. Add code to track the client status in Amazon ElastiCache in the backend service Tracking client connection/disconnection behavior is critical to identifying problematic clients. ElastiCache is a highly suitable tool for storing connection data efficiently. ✅ Must-have. E. Implement $connect and $disconnect routes in the backend service While these routes are necessary for detecting client connections and disconnections, this could be seen as implicit in the implementation of D (since tracking client status assumes these routes are already used). ⚠️ Optional, depending on how the question is interpreted.

sumanshu
Dec 28, 2024

C. Use the callback URL to disconnect the client from the backend service This is essential for removing the client. Without it, the backend has no way to forcibly disconnect a problematic client. ✅ Must-have. D. Add code to track the client status in Amazon ElastiCache in the backend service Tracking client connection/disconnection behavior is critical to identifying problematic clients. ElastiCache is a highly suitable tool for storing connection data efficiently. ✅ Must-have. E. Implement $connect and $disconnect routes in the backend service While these routes are necessary for detecting client connections and disconnections, this could be seen as implicit in the implementation of D (since tracking client status assumes these routes are already used). ⚠️ Optional, depending on how the question is interpreted.

sumanshu
Dec 28, 2024

The two requirements in the question are: Identify a client that keeps connecting and disconnecting: This requires tracking client connections and disconnections over time. To achieve this, the backend needs a mechanism to log or store connection events for each client, which can then be analyzed to identify repeated connection patterns. Remove the client: Once the client is identified as problematic (e.g., frequent connects/disconnects), the backend needs to remove the client. This is achieved using the WebSocket callback URL to explicitly disconnect the client.

sumanshu
Dec 28, 2024

D is critical for tracking client activity. E is required to capture connection and disconnection events. C provides the functionality to disconnect a client once identified. Thus, the correct combination is C, D, and E.

sumanshu
Dec 28, 2024

C. Use the callback URL to disconnect the client from the backend service This is essential for removing the client. Without it, the backend has no way to forcibly disconnect a problematic client. ✅ Must-have. D. Add code to track the client status in Amazon ElastiCache in the backend service Tracking client connection/disconnection behavior is critical to identifying problematic clients. ElastiCache is a highly suitable tool for storing connection data efficiently. ✅ Must-have. E. Implement $connect and $disconnect routes in the backend service While these routes are necessary for detecting client connections and disconnections, this could be seen as implicit in the implementation of D (since tracking client status assumes these routes are already used). ⚠️ Optional, depending on how the question is interpreted.

sumanshu
Dec 28, 2024

C. Use the callback URL to disconnect the client from the backend service This is essential for removing the client. Without it, the backend has no way to forcibly disconnect a problematic client. ✅ Must-have. D. Add code to track the client status in Amazon ElastiCache in the backend service Tracking client connection/disconnection behavior is critical to identifying problematic clients. ElastiCache is a highly suitable tool for storing connection data efficiently. ✅ Must-have. E. Implement $connect and $disconnect routes in the backend service While these routes are necessary for detecting client connections and disconnections, this could be seen as implicit in the implementation of D (since tracking client status assumes these routes are already used). ⚠️ Optional, depending on how the question is interpreted.

sumanshu
Dec 28, 2024

D is critical for tracking client activity. E is required to capture connection and disconnection events. C provides the functionality to disconnect a client once identified. Thus, the correct combination is C, D, and E.

sumanshu
Dec 28, 2024

C. Use the callback URL to disconnect the client from the backend service This is essential for removing the client. Without it, the backend has no way to forcibly disconnect a problematic client. ✅ Must-have. D. Add code to track the client status in Amazon ElastiCache in the backend service Tracking client connection/disconnection behavior is critical to identifying problematic clients. ElastiCache is a highly suitable tool for storing connection data efficiently. ✅ Must-have. E. Implement $connect and $disconnect routes in the backend service While these routes are necessary for detecting client connections and disconnections, this could be seen as implicit in the implementation of D (since tracking client status assumes these routes are already used). ⚠️ Optional, depending on how the question is interpreted.

sumanshu
Dec 28, 2024

C. Use the callback URL to disconnect the client from the backend service This is essential for removing the client. Without it, the backend has no way to forcibly disconnect a problematic client. ✅ Must-have. D. Add code to track the client status in Amazon ElastiCache in the backend service Tracking client connection/disconnection behavior is critical to identifying problematic clients. ElastiCache is a highly suitable tool for storing connection data efficiently. ✅ Must-have. E. Implement $connect and $disconnect routes in the backend service While these routes are necessary for detecting client connections and disconnections, this could be seen as implicit in the implementation of D (since tracking client status assumes these routes are already used). ⚠️ Optional, depending on how the question is interpreted.

AradOptions: CE
Jan 6, 2025

CE is correct.

mooncake1Options: CE
Jan 25, 2025

DE does not make the developer disconnect

mooncake1
Jan 25, 2025

Can't believe DE is 50%.. this q is not even hard