Create a new WebSocket API
In the API Gateway console, choose Create API, New API.
Under Choose the protocol, choose WebSocket.
For API name, enter My Chat API.
For Route Selection Expression, enter $request.body.action.
Enter a description if you’d like and click Create API.
The attribute described by the Route Selection Expression value should be present in every message that a client sends to the API. Here’s one example of a request message:
https://aws.amazon.com/blogs/compute/announcing-websocket-apis-in-amazon-api-gateway/