eidheim / Simple-Web-Server

A very simple, fast, multithreaded, platform independent HTTP and HTTPS server and client library implemented using C++11 and Boost.Asio. Created to be an easy way to make REST resources available from C++ applications.
MIT License
2.62k stars 758 forks source link

Integrating both servers to one #108

Closed harella1 closed 6 years ago

harella1 commented 7 years ago

Hi First, great job, realy. The design of map of urls to function pointers works beautifully and easy to use. I was able to to compile the server and the WebSocket server code on vs2012, if you like, i can pr the sln and vcxproj files. Also added query string parsing on GET urls, and would like to pr too. Now, i wanted to to have a sever that responds to http & can register websocket functions (defferent urls) on same instance, but the asio part i couldn't figure out. This would give a base to having REST like application with push capabilities. What do you think? thank you

eidheim commented 7 years ago

Thank you, a PR on query string parsing is most welcome.

Also, regarding combining Simple-Web-Server and Simple-WebSocket-Server, have a look at https://gitlab.com/eidheim/desktop-stream/blob/master/main.cpp#L182. This possibility was added in case one wants to run HTTP(S) and WS(S) on the same port.

edit: desktop-stream moved to gitlab

harella1 commented 7 years ago

I checked it, and it's what i was trying to achieve. Thank you! I placed PR for query string. One comment - passing all the resources from httpServer to wsServer, http_server.on_upgrade=[&ws_server]... main.cpp line 195, seems to be the default behavior. Don't you think it belong inside http_server.hpp on_upgrade method?

eidheim commented 7 years ago

I chose not to add a Simple-Web-Server as dependency to Simple-WebSocket-Server since one might want to chose to let the upgrade happen from another web-server.

eidheim commented 6 years ago

Closing this as query string parsing was added to the master branch some time back.