Skip to content
프로젝트

aws-samples/simple-websockets-chat-app

GitHub에서 보기

aws-samples/simple-websockets-chat-app has 701 GitHub stars and 272 forks. GitHot measured 0 stars in 24 hours and 0 in 7 days. Last checked 2026-11-25 06:07 UTC. Last push 2026-01-04.

이 수치를 측정하는 방법

측정된 스타 증가

in 24h
0
in 7 days
0
in 15 days
기록 수집 중
in 1 month
기록 수집 중

서로 겹치는 기간의 순증가량이며 일별 합계가 아닙니다. 측정값이 없으면 비워 둡니다. 스타는 관심도를 나타내며 품질을 보장하지 않습니다.

소개

이 SAM 애플리케이션은 Lambda 함수, DynamoDB 테이블 및 역할을 제공하여 API Gateway의 새로운 WebSocket 기반 API 기능을 사용하는 간단한 채팅 애플리케이션을 구축할 수 있도록 합니다.

개발 도구

README.md

Original

simple-websockets-chat-app

Update: We have released an updated and more feature-rich Websocket chat application sample using AWS CDK that you can find here.

This is the code and template for the simple-websocket-chat-app. There are three functions contained within the directories and a SAM template that wires them up to a DynamoDB table and provides the minimal set of permissions needed to run the app:

.
├── README.md                   <-- This instructions file
├── onconnect                   <-- Source code onconnect
├── ondisconnect                <-- Source code ondisconnect
├── sendmessage                 <-- Source code sendmessage
└── template.yaml               <-- SAM template for Lambda Functions and DDB

Deploying to your account

You have two choices for how you can deploy this code.

Serverless Application Repository

The first and fastest way is to use AWS's Serverless Application Repository to directly deploy the components of this app into your account without needing to use any additional tools. You'll be able to review everything before it deploys to make sure you understand what will happen. Click through to see the application details.

AWS CLI commands

If you prefer, you can install the AWS SAM CLI and use it to package, deploy, and describe your application. These are the commands you'll need to use:

sam deploy --guided

aws cloudformation describe-stacks \
    --stack-name simple-websocket-chat-app --query 'Stacks[].Outputs'

Note: .gitignore contains the samconfig.toml, hence make sure backup this file, or modify your .gitignore locally.

Testing the chat API

To test the WebSocket API, you can use wscat, an open-source command line tool.

  1. Install NPM.
  2. Install wscat:
$ npm install -g wscat
  1. On the console, connect to your published API endpoint by executing the following command:
$ wscat -c wss://{YOUR-API-ID}.execute-api.{YOUR-REGION}.amazonaws.com/{STAGE}
  1. To test the sendMessage function, send a JSON message like the following example. The Lambda function sends it back using the callback URL:
$ wscat -c wss://{YOUR-API-ID}.execute-api.{YOUR-REGION}.amazonaws.com/prod
connected (press CTRL+C to quit)
> {"action":"sendmessage", "data":"hello world"}
< hello world

License Summary

This sample code is made available under a modified MIT license. See the LICENSE file.

관련 프로젝트 살펴보기

불러오는 중…