Closed mephinet closed 9 years ago
It's not related to async operation, so you are right. Currently we have no way to fine-tune the response. Unfortunately, Protocol::WebSocket
module family does not expose so many public (and well-documented) methods, so there are few things we can do.
If you really want this feature (i.e., setting sub-protocol in the response), I can make a necessary pull-request to vti/protocol-websocket. After the new version of Protocol::WebSocket
is released, I can implement the feature.
Oops. I found Protocol::WebSocket::Handshake
has res
method and it's documented.
OK, I'll try using this to make an interface to customize the request..
That would be great! :+1:
Released version 0.06.
Thanks a lot, I'll give it a try!
Perfect, specifying a handshake callback allows me to call subprotocol on the response object! Thanks again.
I'm glad to hear that. Thanks for reporting.
I'm rather new to async websocket programming, so I might miss the obvious - but I wasn't able to find a way to set the
Sec-WebSocket-Protocol
of the Response sent byAnyEvent::WebSocket::Server
. Theestablish*
methods of the Server implementation useProtocol::WebSocket::Handshake::Server
to create the HTTP 101 response for the received request. However, they do not allow for the application to influence the creation of theProtocol::WebSocket::Response
- so the user cannot set the "subprotocol" field.