/simple-websockets-app-py

websocket APIs with API Gateway and Lambda running on Python3

Primary LanguagePython

simple-websockets-app-py

Deployment

  • Install python packages
  • aws s3 mb s3://simple-websockets-app-py
  • sam package --template-file template.yaml --output-template-file packaged.yaml --s3-bucket s3://simple-websockets-app-py
  • aws cloudformation deploy --template-file packaged.yaml --stack-name simple-websockets-app-py --capabilities CAPABILITY_IAM
  • Ensure that each lambda is tied to the corresponding route for API Gateway
  • Deploy the APIs for prod

Connecting via websocket

  • Install node modules
  • wscat -c wss://{API-ID}.execute-api.{REGION}.amazonaws.com/prod
  • Type {"action":"sendmessage", "data":"hello world!"}