jaspervdj / websockets

A Haskell library for creating WebSocket-capable servers
http://jaspervdj.be/websockets
BSD 3-Clause "New" or "Revised" License
407 stars 114 forks source link

Share port with restful http #185

Closed BebeSparkelSparkel closed 5 years ago

BebeSparkelSparkel commented 5 years ago

I'm using http-server and would like to use websockets as well on the same port. Is that possible?

jaspervdj commented 5 years ago

Not really -- http-server would need to provide some mechanism to "escape" from the normal HTTP handling and pass the socket over to the websockets library. This functionality is provided by at least warp and snap, which in between them cover a big chunk of the haskell web frameworks.

If you're tied to http-server for some reason; you could also consider using a reverse proxy and passing the websocket connections to a different port internally.

BebeSparkelSparkel commented 5 years ago

Those are great suggestions. Thanks!