Is it possible to pass variables in a websocket $connect call?
I have some existing code using Tomcat and Grizzly webservers, and they accept a path like the following:
wss://<server>/forum/{subject}
It doesn't seem possible to configure API Gateway v2 endpoints to have variables such as subject here. Is that correct or am I missing something?
I realize that I can work around this by sending messages, but it creates an inconsistency from the client perspective and there doesn't seem a good "reason" for it, except it hasn't been done yet.
Currently WebSocket API does not support path variables on $connect. You can send query string or custom header (if the client is non-browser) though.
Thanks.
I wasn't actually able to get the headers approach to work; I'm not sure why, but I only seem to see a subset of the actual headers in the WebSocket lambda.
The query parameters approach worked fine, though.
Relevant questions
Setting up a $connect route that requires a WebSocket subprotocol using a mock integration
asked 2 months agoIs it possible to use CloudFront Functions with CloudFormation, and have the source code in an external file?
asked a month agoWebsocket $connect route: headers and querystring empty on http integration
Accepted Answerasked 3 years agoTrying to use a single Amazon API Gateway endpoint to accept both HTTP and websocket requests
Accepted Answerasked 2 years agoIs possible to set up the BGP pass on a S2S VPN connection
Accepted Answerasked 3 months agoIs it possible to pass variables in a websocket $connect call?
Accepted Answerasked 2 years agoIs it possible to pass a C++ class as a Lua table from a Gem?
Accepted Answerasked 5 years agoCan i access Secrets Manager from Tomcat
asked 3 years agoPassing a custom message from Websocket API Lambda authroizer to the client
asked 12 days agoHow to retrieve path parameters from websocket url in lambda functions
Accepted Answerasked 6 months ago