Skip to content

JayTwoLab/ix-sio

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ix-sio

Korean

Folder Structure

  • ix/: C++ Socket.IO client implementation and related source code
    • main.cpp: Client execution example
    • SioClientBase.hpp, SioClientV2.hpp, SioClientV4.hpp: Socket.IO client implementations
    • CurlGlobal.hpp, WinSockInit.hpp: Network initialization utilities
    • CMakeLists.txt, CMakePresets.json: CMake build configuration files
  • sio2/: Node.js based Socket.IO v2 server example
  • sio3/: Node.js based Socket.IO v3/v4 server example

Key Features

  • Compatibility testing with various versions of Socket.IO servers
  • Provides C++ client and Node.js server example code
  • Easy build environment using CMake

Build and Run Instructions

C++ Client (ix)

  • (1) Build using CMake
      cd ix
      cmake -B build
      cmake --build build
  • (2) Run the client using the executable

Dependency Installation (CURL, spdlog, nlohmann_json, ixwebsocket)

Windows (MSVC + vcpkg)

  1. Install and set up vcpkg
  2. Install packages with vcpkg:
    vcpkg install curl spdlog nlohmann-json ixwebsocket
  3. 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

Linux (gcc + apt/yum)

  • 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 

Installing ixwebsocket on Rocky Linux

Some RHEL-based distributions like Rocky Linux do not provide the ixwebsocket-devel package. In this case, you need to build from source:

  1. Install dependencies
    sudo yum install libcurl-devel spdlog-devel nlohmann-json-devel
  2. 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
  3. 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 ..

Notes

  • Each library is automatically detected with find_package in CMake.
  • Using vcpkg or a package manager allows for easy installation without building from source.

Node.js Server (sio2, sio3)

  • (1) Install dependencies in each folder (sio2, sio3)
      npm install
  • (2) Run the server
      node server2.js  # or node server3.js

About

c++ socket.io library based on ixwebsocket

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors