trio-websocket icon indicating copy to clipboard operation
trio-websocket copied to clipboard

Connection upgrade example

Open belm0 opened this issue 7 years ago • 3 comments

Would be great to have an example of upgrading a connection from http, based on the trio-server example in h11.

belm0 avatar Aug 28 '18 23:08 belm0

Thanks for all the feedback! I am going to start tackling these issues today.

mehaase avatar Sep 04 '18 13:09 mehaase

I'm taking a look at h11's example trio-server.py. I think what you're asking for here is a documented example of the following:

  • A web server (like h11's trio-server.py) receives a new connection.
  • It processes the WebSocket HTTP upgrade request.
  • It wraps the resulting stream in a WebSocketConnection.

Is this right?

It's not clear to me if wsproto supports this: it looks like it always wants to do the HTTP upgrade request. To make this work, I think we would need a way for wsproto to skip the upgrade request and obtain that metadata (like host header) from somewhere else. Thoughts?

mehaase avatar Oct 11 '18 16:10 mehaase

It looks like this behavior was submitted to wsproto but is currently on hold: https://github.com/python-hyper/wsproto/pull/37

mehaase avatar Oct 11 '18 17:10 mehaase