socket.io-chat-with-native
github仓库地址: https://github.com/sliver-chen/socket.io-chat-with-native/tree/master/build
目录结构
├── [root 4096] build
├── [root 4096] client
├── [root 126] CMakeLists.txt
├── [root 389] readme.md
└── [root 4096] server
build: 编译目录
client: C++ native client 依赖于socket.io-poco
CMakeLists.txt: CMake脚本
readme.md: readme
server: node.js server 依赖于socket.io 在server/package.json中指明了版本依赖
工作原理
利用socket.io-poco构造C++的socket.io支持
C++ client和node.js server通过socket.io交换消息
核心在于socket.io的使用 通过固定的connect事件连接client和server
message事件发送和接收消息