WebSockets in CDK
CDK doesn't currently have a simple way to create a WebSocket API with API Gateway V2, so I've painstakingly done it from the Cf* primitives, and I hope it's helpful to others.
How to get this running
npm install -g aws-cdk
Install cdkcdk deploy
deploy this stack to your default AWS account/regionwscat -c <WebSocketEndpoint>
connect to the WebSocket withwscat
and theWebSocketEndpoint
, which is an output from the CloudFormation stack, and should be displayed on the commandline after a successful deployment- Type a message and it should be echoed back to you