I have written some small web apps that make use of a websocket based server in C++. I use the excellent framework websocketpp that makes it a breeze to use websockets in C++. It is a header only library so you only need to add the header file in your project to use it. In some cases it does need the boost libraries and I had to install and link to the boost system. It is not a big deal adding boost on mac from macports. Get it at https://github.com/zaphoyd/websocketpp.
The first app I wrote is based on an example that the author of websocketpp have provided on his website. I have modified it to fit my needs.
The app keeps track of a football league and while not rocket science I did learn a lot from this. It is very simple at the moment and can only keep track of goals and points and is not intended to replace the tools the big newspaper sites use for the various leagues around the world. My target audience is more the local leagues that do not have a dedicated journalist to update the table, cards given, corners and other useful information. My idea is to have friends and families update the goal score, crowdsourcing in other words.
I use postgresql as database. This is a database I am very comfortable with and have used it since version 7 back in 2002.
Postgresql provides an official C++ driver I use.
The first version had all the logic in main.cpp but I have later moved the websocket-part into a websocketserver class and database calls to a database class.
The next step was to add a simple database connection pool. When searching I came across this stackoverflow thread that inspired me. http://stackoverflow.com/questions/12528199/libpqxx-connection-pool.
I added pooling by using std::stack pushing and popping them on and off. Easier than I initially thought it would be.