This is a Serverless project which creates a websocket chat backend. It's quite basic, but supports some standard features including setting a nickname, multiple channels, and broadcasting messages to channel members. The coolest this is that this is entirely serverless and in Python!
- Add AWS credentials into the
envs/$(whoami)file. This file can be named anything, but I suggest your username or something else specific. You can just name itenvs/devas well. Seeenvs/examplefor help. Useus-west-2as your default region, others will not function properly. - Start up the shell with docker:
ENV=$(whoami) make shellNOTE: The value afterENV=is merely the name of the file you created. So if you created theenvs/devfile, doENV=dev. Now you're in your Docker container which has all of the necessary libraries and tooling.
Run all of the following commands in your Docker container!
- Run
make deploy - This will deploy everything you need to AWS. You'll see a websocket URI from the output of that command, something like
wss://aipsb783ea.execute-api.us-west-2.amazonaws.com/username - Install
wscatby just runningyarn(still in the/codedirectory) - In two different terminals:
./node_modules/.bin/wscat -c wss://YOUR_WS_ENDPOING - Now start typing...you'll see messages from one window pop up into another.
/name bz- Change your display name tobz/channel random- Change to therandomchannel. Default channel isgeneral/help
This project was bootstrapped using the my Serverless Cookiecutter template. This is a opinionated setup in order to facilitate developing, running and bootstrapping Serverless projects authored in Python.
For more information, see the following: