Is there any way to authorize a WebSocket connecti...
# http4k
a
Is there any way to authorize a WebSocket connection? It seems like the
WsFilter
only works with a
Websocket
that's already open. Is the only alternative to close the
Websocket
immediately after failing to validate the authorization?
d
AFAIK, that's effectively the way to do it - with an appropriate code. (1008?). Let us know if you find other mechanisms! 🙂
a
Will do, thanks. Related: I'm struggling to think of a use-case for a
WsFilter
. What did you have in mind when you added it?
d
the usual cross cutting stuff - logging, security. doesn't that work?
a
I suppose it does. 🤔
Might be worth a doc update to give an example or two