CLOUD LABS
Building a WebSocket-Based Chat Application Using API Gateway
Create a simple chat application using AWS's API Gateway, Lambda, and DynamoDB services.
beginner
Certificate of Completion
Learning Objectives
API Gateway is an AWS service through which we can create, manage, and deploy different types of APIs, including HTTP, REST, and WebSocket.
In this Cloud Lab, you’ll learn to create a simple multiuser chat application using API Gateway, Lambda, and DynamoDB. You’ll first create a DynamoDB table to serve as our database. Then, you’ll create a Lambda function that will contain the core logic of our application. Finally, you’ll create and deploy a WebSocket API so users can communicate with the server.
By the end of this Cloud Lab, you’ll have hands-on experience developing and managing WebSocket APIs on API Gateway.
The following is the high-level architecture diagram of the infrastructure that we will create in this Cloud Lab:
Before you start...
Try these optional labs before starting this lab.
Relevant Courses
Use the following content to review prerequisites or explore specific concepts in detail.
Frequently Asked Questions
What is a WebSocket API gateway?
A WebSocket API is a set of routes in API Gateway that connect to Lambda functions, backend HTTP endpoints, or other AWS services. When combined with other API Gateway features, WebSocket API allows you to manage every step of the API life cycle, from creation to monitoring in production.
Is WebSocket a protocol or API?
WebSocket is a communication protocol that enables full-duplex communication over a single TCP connection. While WebSocket is not an API, it can be implemented using various APIs, such as the WebSocket API in web browsers or managed services like Amazon API Gateway for WebSocket-based communication.
Do chat applications use WebSockets?
Chat applications often use WebSockets to provide real-time, bidirectional communication between clients and servers.
How many WebSockets can a server handle?
The number of WebSocket connections a server can handle depends on factors like server resources, network bandwidth, and the specific implementation. Optimized servers can manage 100,000+ connections, while AWS API Gateway supports 500,000 per region.
How many messages can a WebSocket handle?
A WebSocket connection can handle a high volume of messages, with performance primarily dependent on server capacity, network bandwidth, and application efficiency. Optimized implementations can process thousands to millions of messages per second.
How do I call WebSocket API?
You can call a WebSocket API as follows:
- Using
wscat
to connect to your WebSocket API and send messages - Using the
@connections
API from your backend service to send a callback message - Using a client-side WebSocket library to invoke your WebSocket API
Are WebSockets hard to implement?
Implementing WebSockets can be straightforward, especially with managed services like Amazon API Gateway, which handle much complexity. However, developers should be familiar with basic concepts of network communication.
Trusted by 1.4 million developers working at companies including
Your method is simple, straight to the point and I can practice with it everywhere, even from my phone, that's something I have never had in other learning platforms.

I highly recommend Educative. The courses are well organized and easy to understand.

I prefer Educative courses because they have a nice mix of text & images. I find that with full video courses, it can often be too easy to go into passive learning mode.

I prefer Educative courses because they have a nice mix of text & images. I find that with full video courses, it can often be too easy to go into passive learning mode.

Your method is simple, straight to the point and I can practice with it everywhere, even from my phone, that's something I have never had in other learning platforms.

I highly recommend Educative. The courses are well organized and easy to understand.

I prefer Educative courses because they have a nice mix of text & images. I find that with full video courses, it can often be too easy to go into passive learning mode.

Get access to Educative Cloud Labs
Copyright ©2025 Educative, Inc. All rights reserved.