Setting up a $connect route that requires a WebSocket subprotocol using a mock integration

0

My WebSocket API needs to be able to use a custom subprotocol.

I have been able to do this by returning the proper Sec-WebSocket-Protocol header using AWS_PROXY lambda integration approach described in AWS docs here: https://docs.aws.amazon.com/apigateway/latest/developerguide/websocket-connect-route-subprotocol.html.

The downside of that approach is that creating a dedicated lambda to just return a static header on each connect is an overkill. Is it possible to return the Sec-WebSocket-Protocol header on $connect using a Mock Integration instead?

I tried playing with different response mappings of the Mock Integration but couldn't make it return this static header.

It looks like you can't control the Sec-WebSocket-Protocol at all while using the Mock Integration, what about other integrations?

adel
asked 2 years ago94 views
No Answers

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions