In the plugin directory (serverless-offline): npm link
Set AWS credentials, e.g.: export AWS_PROFILE=...
To start AWS DynamoDB locally (can run only after first deploying locally): sls dynamodb install
sls dynamodb start
npm run deploy-offline
and then sls offline
for each additional local deploy.
npm run deploy-aws
and then sls deploy
for each additional AWS deploy.
npm run test
npm --endpoint={WebSocket endpoint URL on AWS} --timeout={timeout in ms} run test
POST http://localhost:3001/@connections/{connectionId}
Or,
let endpoint=event.apiGatewayUrl;
if (!endpoint) endpoint = event.requestContext.domainName+'/'+event.requestContext.stage;
const apiVersion='2018-11-29';
const apiGM=new API.ApiGatewayManagementApi({ apiVersion, endpoint });
apiGM.postToConnection({ConnectionId, Data});