增加websocket支持
This commit is contained in:
@@ -64,11 +64,16 @@ namespace ylib
|
||||
* param
|
||||
* callback : 触发回调
|
||||
******************************************************************/
|
||||
void other(std::function<void(network::http::request*, network::http::response*)> callback);
|
||||
void other(std::function<void(network::http::request*, network::http::response*,network::http::websocket_message*)> callback);
|
||||
/******************************************************************
|
||||
* function:数据接收后回调
|
||||
******************************************************************/
|
||||
void on_recved(std::function<void(const ylib::buffer& begin, ylib::buffer* end)> callback);
|
||||
|
||||
/******************************************************************
|
||||
* function:关闭回调
|
||||
******************************************************************/
|
||||
void on_close(std::function<void(uint64 connid,network::http::websocket_message* ws_msg)> callback);
|
||||
/******************************************************************
|
||||
* function:数据发送前回调
|
||||
* desc:不支持大文件断点传输方式
|
||||
@@ -90,6 +95,8 @@ namespace ylib
|
||||
private:
|
||||
// 添加任务
|
||||
void push(reqpack* rp);
|
||||
// 添加连接断开任务
|
||||
void push_close(uint64 connid,std::shared_ptr<network::http::websocket_message> ws_msg);
|
||||
// 是否为代理任务
|
||||
bool is_proxy(reqpack* rp);
|
||||
// 是否为CDN服务
|
||||
@@ -102,11 +109,13 @@ namespace ylib
|
||||
// 线程池
|
||||
IHPThreadPool* m_threadpool;
|
||||
// [回调] 未订阅请求
|
||||
std::function<void(network::http::request*, network::http::response*)> m_callback_other;
|
||||
std::function<void(network::http::request*, network::http::response*,network::http::websocket_message*)> m_callback_other;
|
||||
// [回调] 接收后
|
||||
std::function<void(const ylib::buffer& begin, ylib::buffer* end)> m_callback_recved;
|
||||
// [回调] 发送前
|
||||
std::function<void(const ylib::buffer& begin, ylib::buffer* end)> m_callback_sendbefore;
|
||||
// [回调] 关闭
|
||||
std::function<void(uint64 connid,network::http::websocket_message* ws_msg)> m_callback_close;
|
||||
// 拦截器
|
||||
std::unique_ptr<network::http::interceptor> m_interceptor;
|
||||
// 订阅器
|
||||
|
||||
Reference in New Issue
Block a user