Is it possible to pass variables in a websocket $connect call?

0

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.

Gazza
gefragt vor 4 Jahren796 Aufrufe
2 Antworten
0
Akzeptierte Antwort

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.

AWS
beantwortet vor 4 Jahren
0

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.

Gazza
beantwortet vor 4 Jahren

Du bist nicht angemeldet. Anmelden um eine Antwort zu veröffentlichen.

Eine gute Antwort beantwortet die Frage klar, gibt konstruktives Feedback und fördert die berufliche Weiterentwicklung des Fragenstellers.

Richtlinien für die Beantwortung von Fragen