-
Notifications
You must be signed in to change notification settings - Fork 222
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
Add method to "upgrade" hyper request to a WebSocket. #53
Comments
+1 seems like a good idea. This is like #46 (which never got fixed I'm pretty sure). I was leaning towards getting rid of hyper as a dependency so whatevery the fix is it should be able to fit with every http implementation out there. |
I imagine something like taking a hyper |
It's not enough to pass a So like Is that API good for your use case? |
I thought the The problem with that API is that (IIUC) it reads the request itself (or at least the Headers). The reason I wanted to "upgrade" the request manually is so that I can do routing, authentication and whatever else I want based on the headers. Your method allows me to route requests if it isn't a websocket connection but doesn't give me the option if it is. |
Your right, I wasn't familiar with hyper's impl IntoWebSocket for Reqeust {
fn into_ws(self) -> Result<(&mut Self, Client), (Self, Err)> {
// ...
}
} Would you rather Since I'm not familiar with hyper it would help to know what code you would want to write to do this. |
I imagine owning it would be fine. I don't think there is any legitimate use of using it after a websocket connection has ended. |
Is there any progress on this? |
Currently the HTTP request is parsed inside of the library. It would be nice if there was a way to check if an existing hyper
Request
is a websocket request, and if so provide a way to "upgrade" it into a websocket connection. This allows using hyper as a HTTP server and accepting websockets on the same port.This is similar to how the ruby library faye-websocket works. You can check the env (essentially a standard request format) if it is a websocket, and if so "upgrade" it into a websocket connection.
The text was updated successfully, but these errors were encountered: