GithubHelp home page GithubHelp logo

danilop / serverless-chat Goto Github PK

View Code? Open in Web Editor NEW
107.0 9.0 30.0 21 KB

A serverless web chat built using AWS Lambda, AWS IoT (for WebSockets) and Amazon DynamoDB

License: Apache License 2.0

JavaScript 69.99% HTML 6.42% Shell 19.78% CSS 3.81%
aws aws-iot aws-lambda amazon-dynamodb websockets serverless mqtt

serverless-chat's Introduction

Serverless Chat

A serverless web chat built using AWS Lambda, AWS IoT (for WebSockets) and Amazon DynamoDB.

The architecture of this application is described in this article:

Deploying to AWS

A script is provided, deploy.sh which uses AWS CloudFormation to provision all the resources needed for this demo. To use it:

  • Create an AWS account.

  • Visit the IoT management page in the AWS web console and ensure that an IoT endpoint has been provisioned for your account.

  • Install the AWS command line tools and set up your credentials.

  • Run the deploy.sh script, specifying a name for your new CloudFormation stack, an AWS region and the name of an S3 bucket where the CloudFormation config files will be stored. The S3 bucket will be created if it does not exist.

    ./deploy.sh LambdaChatStack us-west-1 my.s3.bucket.name

Once the AWS resources have been provisioned, the script will print a URL to visit in your browser to see the demo.

NB: The Kinesis functionality has been disabled because it is billed per shard-hour. To enable it, edit cloudformation/template.yaml and uncomment the relevant lines before running deploy.sh.

serverless-chat's People

Contributors

danilop avatar octachrome avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

serverless-chat's Issues

Deployment documentation

Just saw your talk at SFLoft. Would it be possible for you to cover the deployment process of an app like this? There is good number of AWS services this depends on, would be great to see how it all comes together on the console.

Idempotency Concern of the ChatFunction

Description:

I would like to kindly bring attention to a potential issue in the ChatFunction, which is invoked by the chatRule IoT TopicRule. This function calls the IotData.publish to send chat messages to the frontend, where the frontend appends the new messages with previous ones. However, this message sending is not idempotent. Suppose the IoT-triggered function crashes after successfully sending a chat message to the frontend-facing IoT topic (but before acknowledging the event source that the function has finished). In that case, when the function is retried, another message will be sent and received by the frontend.

Suggested Fix:

Although there's no serious harm in sending two identical chat messages, this duplicate sending due to untimely retries can be prevented. Specifically, one can attach a unique id to each chat message when the message is being generated. Before the frontend appends the new message to the message list, it should check whether the message id is already present in a deduplication set for holding all previous chat message ids. If the id is already present, don't append the message. Otherwise, append the message as usual.

Thank you for considering this feedback. I hope that this suggestion could help improve the idempotency and user experience of the ChatFunction. Please feel free to reach out if you have any questions or concerns.

Infrastructure Cost

How much does the infrastructure needed to run this chat app cost approximately for a small amount of usage/users on average?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.