Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
xmh0511 committed May 31, 2019
1 parent eed5b26 commit a2050bd
Showing 1 changed file with 25 additions and 1 deletion.
26 changes: 25 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
3. 跨平台
4. 支持拦截器功能
5. 支持session/cookie (持久化,默认保存到磁盘。用户可以自定义持久化介质)
6. 易用的客户端(http client/ https client 可以通过CMakeList.txt中的ENABLE_CLIENT_SSL ON开启)
6. 支持websocket
7. 易用的客户端(http client/ https client 可以通过CMakeList.txt中的ENABLE_CLIENT_SSL ON开启)

# 目录
* [如何使用](#如何使用)
Expand Down Expand Up @@ -391,6 +392,29 @@ int main()
````
### 以上所有使用lambda注册的路由 都可以替换成成员函数或controller

# 好用的webscoket
````
#include "http_server.hpp"
int main()
{
http_server serve(4) //线程数
serve.listen("0.0.0.0","8080");
websocket_event event; //定义websocket 事件
event.on("message", [](websocket& ws) {
std::cout << ws.messages() << std::endl; //消息内容
std::cout << (int)ws.message_code() << std::endl; //消息类型
std::string message;
for (auto i = 0; i <= 400; ++i) {
message.append(std::to_string(i));
}
ws.write_string(message); //发送消息 ws.write_binary("xxx")用来写二进制类型的数据 || ws.write("xxx",opcode);
}).on("open", [](websocket& ws) {
std::cout << "open" << std::endl;
});
}
````

# xfinal client 使用
## GET请求
### client 同步
Expand Down

0 comments on commit a2050bd

Please sign in to comment.