websocket for C++
#1 环境
C++11
boost 1.58.0
Ubuntu 16.04
cmake 3.18.2
websocketpp
#1 websocketpp 安装
websocketpp 依赖boost,需要先将boost装好
- 下载
git clone https://github.com/zaphoyd/websocketpp.git
- 编译安装
cd websocketpp
mkdir build
cd build
cmake ..
make
sudo make install
安装路径 : /usr/local/include/websocketpp
#2 使用
main.cpp
#include <iostream>
#include <websocketpp/config/asio_no_tls.hpp>
#include <websocketpp/server.hpp>
#include <websocketpp/config/asio_no_tls_client.hpp>
#include <websocketpp/client.hpp>
#include <functional>
typedef websocketpp::server<websocketpp::config::asio> io_server;
typedef websocketpp::client<websocketpp::config::asio_client> io_client;
class WebSocketServer {
public

本文介绍如何在C++11环境下使用WebSocket++库搭建WebSocket服务器。详细步骤包括安装配置、依赖项处理及示例代码演示。
最低0.47元/天 解锁文章
339

被折叠的 条评论
为什么被折叠?



