New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Select an arbitrary websocket subprotocol proposed by the client #8860
Select an arbitrary websocket subprotocol proposed by the client #8860
Conversation
* | ||
* See https://github.com/playframework/playframework/issues/7895 | ||
*/ | ||
def handleWebSocket(upgrade: UpgradeToWebSocket, flow: Flow[Message, Message, _], bufferLimit: Int): HttpResponse = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should at least deprecate this. I'm not even sure this class should be considered part of the public API.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, @raboof.
How hard is to add a test for this in https://github.com/playframework/playframework/blob/master/framework/src/play-integration-test/src/test/scala/play/it/http/websocket/WebSocketSpec.scala?
Not really AFAICS, as it seems WebSocketClient doesn't allow setting that header... |
I think we can change Line 123 in c038bc1
Instead of just using an empty |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Thank you, @raboof.
* Select an arbitrary websocket subprotocol proposed by the client * Mark method without subprotocol as deprecated * Add integration test
Backport to 2.7.x: 9d1f9fe |
How to use this feature? When we use WebSocket.accept(...) or WebSocket.acceptOrResult(...) with AkkaHttp Server or the Netty Server, it does not pick the subprotocol. What I am missing here, is there any extra configuration needed for this? |
@marcospereira is any chance for backport to 2.6.x branch? |
Simple (on par with Netty) solution to #7895. Later we could extend our API to
allow the framework user to select a subprotocol instead.