Websocket-quick-start it's a simple example of working with aws websockets and serverless
- Set-up your provider credentials. Watch the video on setting up credentials
- Install serverless via npm:
npm install -g serverless
- Install dependencies via npm:
npm install
- Deploy a Service:
sls deploy --stage dev
or
sls deploy --stage dev --aws-profile yourProfile
- To test the WebSocket API, you can use wscat, an open-source, command line tool.
npm install -g wscat
- On the console, connect to your published API endpoint by executing the following command:
wscat -c wss://{YOUR-API-ID}.execute-api.{YOUR-REGION}.amazonaws.com/{STAGE}
- To test the ping function, send a JSON message:
{"action": "ping"}
- You will receive the
pong
.