More info here: https://coderecipe.ai/architectures/34142257
Problem Statment
Build a simple but scalable chat room like gitter with default sentiment analysis that detects negative sentences.
Solution
Leverage API Gateway's Websocket API to send and receive messages in real time without hosting a dedicated server, and Google’s Natural Language API to analyze sentiment of messages.
Functional Requirements:
Chatroom where multiple users can connect and chat in real time
Provide sentiment analysis for each chat
Performance Requirements:
Simultaneous connect with multiple users and send and receive multiple messages
Able to scale automatically without worry about setting up servers to maintain connections
Assumptions:
Assuming each users do not get to see the messages sent before they join
Prerequisites
npm install serverless
export AWS_ACCESS_KEY_ID=<your-key-here>
export AWS_SECRET_ACCESS_KEY=<your-secret-key-here>
Fill in the services/chatroom/config.<stage>.json
file with the correct google cloud credentials which can be obtained from here.
Deploy
serverless create --template-url https://github.com/CodeRecipe-dev/ServerlessChatroomAWS-GCP --path coderecipe-serverless-chatroom
cd coderecipe-serverless-chatroom
npm install
serverless deploy --stage sample --CONNECTIONS_TABLE coderecipe-connections