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/dev
as well. Seeenvs/example
for help. Useus-west-2
as your default region, others will not function properly. - Start up the shell with docker:
ENV=$(whoami) make shell
NOTE: The value afterENV=
is merely the name of the file you created. So if you created theenvs/dev
file, 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
wscat
by just runningyarn
(still in the/code
directory) - 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 therandom
channel. 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: