Socket.IO C++Socket.IO 的一个 C++ 客户端开发包
Socket.IO C++ 是 Socket.IO 的一个 C++ 客户端开发包。依赖于 websocket++ ,灵感来自 socket.io-clientpp.
特性:
-  
100% 采用 C++11 编写
 -  
兼容 1.0+ 协议
 -  
支持二进制
 -  
自动 JSON 编码
 -  
支持多路复用
 -  
API 类似 Socket.IO JS 客户端
 
示例代码:
sio::client h;
h.connect("http://127.0.0.1:3000");
//emit text
h.socket()->emit("add user", username);
//emit binary
char buf[100];
h.socket()->emit("add user", std::make_shared<std::string>(&buf,100));
//emit message object with lambda ack handler
h.socket()->emit("add user", string_message::create(username), [&](message::ptr const& msg)
{
}); 
示例应用截图:
评论
