The Web server models applications as "servlet : request -> response" and there's no way to go from the request to the original HTTP connection.
In contrast, the Web server has a lower level concept of a "dispatcher" that receives a parsed HTTP request AND the connection object (which has the I/O ports). If the WebSocket handshake has the sender start with a correctly formatted HTTP request, then this is what you want and you'd go from using something like serve/servlet to using something like serve/launch/wait and dispatch/servlet with another layer of dispatching. On the other hand, if the handshake doesn't have a complete request, then you'd need to customize the dispatching server directly with a new kind of read-request and request structure that can stop in the middle. I think what I'd do is make a super-struct and re-use everything from the HTTP server when the handshake isn't there. Jay On Sat, Mar 21, 2015 at 8:44 PM, Alexis King <lexi.lam...@gmail.com> wrote: > The WebSocket handshake is intentionally implemented in such a way so that > WebSocket connections can be performed using the same port that the HTTP > server is running on. This is implemented by making the handshake a standard > HTTP 1.1 GET request with an “Upgrade: websocket” header. > > I’m interested in doing this using the Racket web server, but I’m not sure > how to intercept websocket connections. I’m completely willing to implement > all the websocket connection logic myself, I just need to know how to detect > headers sent with that Upgrade header before the web server has a chance to > handle them so that I can pass the connection off to my own websocket logic. > > What’s the proper way to achieve this sort of thing? > > Alexis > ____________________ > Racket Users list: > http://lists.racket-lang.org/users -- Jay McCarthy http://jeapostrophe.github.io "Wherefore, be not weary in well-doing, for ye are laying the foundation of a great work. And out of small things proceedeth that which is great." - D&C 64:33 ____________________ Racket Users list: http://lists.racket-lang.org/users