C++basedsocket.ioclient- Provides a
Socket.IOclient implementation based onIXWebSocket
- Provides a
Node.jsbasedsocket.ioserverexamples
ix/: C++Socket.IOclient implementation and related source codemain.cpp: Client execution exampleSioClientBase.hpp,SioClientV2.hpp,SioClientV4.hpp: Socket.IO client implementationsCurlGlobal.hpp,WinSockInit.hpp: Network initialization utilitiesCMakeLists.txt,CMakePresets.json: CMake build configuration files
sio2/: Node.js basedSocket.IOv2 server exampleserver2.js:Socket.IOv2 server codepackage.json: Dependencies and run scripts
sio3/: Node.js basedSocket.IOv3/v4 server exampleserver3.js:Socket.IOv3/v4 server codepackage.json: Dependencies and run scripts
- Compatibility testing with various versions of Socket.IO servers
- Provides C++ client and Node.js server example code
- Easy build environment using CMake
- (1) Build using CMake
cd ix cmake -B build cmake --build build - (2) Run the client using the executable
- Install and set up vcpkg
- Install packages with vcpkg:
vcpkg install curl spdlog nlohmann-json ixwebsocket
- Specify the vcpkg toolchain file when building with CMake:
cmake -B build -DCMAKE_TOOLCHAIN_FILE="<vcpkg-root>/scripts/buildsystems/vcpkg.cmake" cmake --build build- Replace
<vcpkg-root>with your vcpkg installation path
- Replace
- Debian/Ubuntu (apt):
sudo apt update sudo apt install libcurl4-openssl-dev libspdlog-dev nlohmann-json3-dev libixwebsocket-dev
- Fedora (dnf):
sudo dnf install libcurl-devel spdlog-devel nlohmann-json-devel
- CentOS/RHEL (yum):
sudo yum install libcurl-devel spdlog-devel nlohmann-json-devel
Some RHEL-based distributions like Rocky Linux do not provide the ixwebsocket-devel package.
In this case, you need to build from source:
- Install dependencies
sudo yum install libcurl-devel spdlog-devel nlohmann-json-devel
- Download and build IXWebSocket from source
git clone https://github.com/machinezone/IXWebSocket.git cd IXWebSocket mkdir build && cd build cmake .. make -j sudo make install
- Or download and install a specific release version: https://github.com/machinezone/IXWebSocket/releases
- If CMake does not automatically detect the IXWebSocket installation path, add the install path to
CMAKE_PREFIX_PATH:cmake -B build -DCMAKE_PREFIX_PATH="/usr/local" # or cmake -DCMAKE_INSTALL_PREFIX=/your/custom/path ..
- Each library is automatically detected with
find_packagein CMake. - Using vcpkg or a package manager allows for easy installation without building from source.
- (1) Install dependencies in each folder (
sio2,sio3)npm install
- (2) Run the server
node server2.js # or node server3.js