Requirement Summary:
WebSocket-based messaging app using API Gateway WebSocket APIs
Need to:
Identify clients repeatedly connecting/disconnecting
Be able to remove problematic clients
Evaluate Options:
A. Switch to HTTP APIs
HTTP APIs don’t support WebSocket connections
B. Switch to REST APIs
REST APIs are not compatible with WebSockets
C. Use the callback URL to disconnect clients
⚠️ Possible, but not a direct option
Callback URLs are used for sending messages to connected clients, not for disconnecting
D. Track client status in ElastiCache
Good solution: Store and update connection state (connected, disconnected, timestamps)
Helps track abuse or reconnections
E. Implement $connect and $disconnect routes
Required to capture connection lifecycle events
These can be used to log/store client behavior and decide on removal
WebSocket routes in API Gateway: https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-websocket-api-route-selection.html
Managing WebSocket connections: https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-websocket-api-mapping-template-reference.html
Submit