Ravindra BagaleCourses & study guides मराठी Track your progress

Ravi Sir's Cards › AWS

WebSocket chat room

What is a VPC: your own private network inside one AWS Region, example ThreeTierVpc 10.0.0.0/16.

WebSocket chat room WhatsApp Web and live support need push. Refreshing HTTP every second wastes battery and still feels laggy. API Gateway WebSocket API keeps a connection. Routes $connect, $disconnect, and sendMessage hit Lambda. DynamoDB stores connectionIds and messages. Create WebSocket API, three routes to Lambda, table PK connectionId, tiny HTML client with new WebSocket(wssURL). Two browse
WebSocket chat room · Download PNG
Read card text

What this card says

Why do we need it?

WhatsApp Web and live support need push. Refreshing HTTP every second wastes battery and still feels laggy.

What is it?

API Gateway WebSocket API keeps a connection. Routes $connect, $disconnect, and sendMessage hit Lambda. DynamoDB stores connectionIds and messages.

How to do it

Create WebSocket API, three routes to Lambda, table PK connectionId, tiny HTML client with new WebSocket(wssURL).

$connect

Example

Two browser tabs connect; one sends hello; both see the message via Management API PostToConnection.

See all AWS revision cards