Blog
Thoughts on engineering, design, and building great products.
WebSocket API: Pushing Click Counts to a Realtime Dashboard
Build the realtime part of the dashboard. Stand up an API Gateway WebSocket API with $connect and $disconnect routes, store each connection in DynamoDB tied to the link it watches, then have the aggregator push the new click count down to exactly the open connections each time it finishes counting. Open a real connection, click the link, and watch the number jump to the browser with no reload.
API Gateway: HTTP API or REST API, and Building the First Routes
API Gateway has two API types with two feature sets and two price tiers. Compare HTTP API and REST API to pick the right one for the URL shortener, then build two real routes: POST /links to create a link and GET /{code} for a 301 redirect. Handle validation, path parameters, and CORS preflight so the dashboard article later doesn't break.