ExitWebSockets: connection-aware real-time delivery1 / 9
Explanation

Separate the socket from the routing state

How connection registries and subscription mappings route published events to WebSocket clients while handling disconnects, reconnects, and slow consumers. · advanced

A persistent WebSocket connection is a delivery address, not a subscription. API Gateway holds the socket; short-lived handlers maintain application state. A connection registry associates a connection ID with its principal, tenant, endpoint, and lifetime. A subscription mapping associates an authorized topic with connection IDs.

This design accepts subscribe and publish commands through the socket. Route handlers update membership or enqueue an authorized publication. A separate worker resolves its recipients and calls PostToConnection for each one. API Gateway does not automatically turn application topics into WebSocket broadcasts. The diagram shows application interactions; routine service acknowledgments are omitted.

The selected interfaces matter: the gateway must expose API Gateway routes and its connection-management API, the registry must support keyed membership queries and conditional updates, and the backlog must support SQS visibility and deletion semantics. Similar-looking messaging services are not interchangeable implementations of these contracts.

RoleSelected componentNearby alternativesContract they lack
Socket gatewayAPI GatewayELB; AppSyncAPI Gateway routes and PostToConnection
Queryable membershipDynamoDBEventBridge; SNSKeyed registry queries and conditional updates
Work backlogSQSKinesis Data Streams; Data FirehoseSQS visibility and per-message deletion
Client commandsRoute invocationsMembership updatesPublished eventsEvent batchesQuery or cleanupRecipient recordsPostToConnectionEvent frames
UsersWebSocket clients
Amazon API GatewayWebSocket API
AWS LambdaConnection and message routes
Amazon DynamoDBConnections and subscriptions
Amazon Simple Queue Service (Amazon SQS)Published-event backlog
AWS LambdaFan-out worker

1 / 6 Clients send subscription and publication commands over their established API Gateway WebSocket connections.

AWS architecture icons are the property of Amazon Web Services. BlowStack is not affiliated with or endorsed by AWS.