C++ WebSocket Server Workshop

December 8, 2016 ยท View on GitHub

The completed source code for this workshop can be found here: https://github.com/adamrehn/websocket-server-demo/.

This workshop demonstrates how to create a C++ server that communicates with a web client using the WebSocket protocol. The main skills covered are:

  • Using the server functionality of the WebSocket++ WebSocket library
  • Basic JSON serialisation using the JsonCpp library
  • Using the asio::io_service event loop functionality from Boost.Asio
  • Implementing the Observer Pattern using both std::bind and C++11 lambdas as callbacks
  • Basic multi-threading using C++11 threads
  • Communicating between event loops on multiple threads

The workshop is broken down into a series of parts: