增加websocket支持
This commit is contained in:
@@ -31,7 +31,9 @@ namespace ylib
|
||||
/// <param name="connid"></param>
|
||||
/// <param name="server"></param>
|
||||
/// <param name="website"></param>
|
||||
reqpack(const std::string& url, const std::string& host, const ylib::buffer& data, uint64 connid, network::http::server* server,network::http::website* website);
|
||||
/// <param name="msg_type"></param>
|
||||
/// <param name="ws_msg"></param>
|
||||
reqpack(const std::string& url, const std::string& host, const ylib::buffer& data, uint64 connid, network::http::server* server,network::http::website* website, network::http::message_type msg_type, std::shared_ptr<network::http::websocket_message> ws_msg = nullptr);
|
||||
~reqpack();
|
||||
/// <summary>
|
||||
/// 请求对象
|
||||
@@ -78,11 +80,30 @@ namespace ylib
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
ylib::json& extra() { return m_extra; }
|
||||
/// <summary>
|
||||
/// 消息类型
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
network::http::message_type msg_type() { return m_msg_type; }
|
||||
/// <summary>
|
||||
/// WebSocket消息
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
const std::shared_ptr<network::http::websocket_message>& ws_msg() { return m_ws_msg; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 设置为关闭连接包
|
||||
/// </summary>
|
||||
void set_close() { m_is_close = true; }
|
||||
bool is_close() { return m_is_close; }
|
||||
private:
|
||||
// 请求
|
||||
std::shared_ptr<network::http::request> m_request;
|
||||
// 回复
|
||||
std::shared_ptr<network::http::response> m_response;
|
||||
// WebSocket消息
|
||||
std::shared_ptr<network::http::websocket_message> m_ws_msg;
|
||||
// httpserver
|
||||
network::http::server* m_server = nullptr;
|
||||
// 请求地址
|
||||
@@ -97,6 +118,11 @@ namespace ylib
|
||||
uint64 m_connid = 0;
|
||||
// 附加数据
|
||||
ylib::json m_extra;
|
||||
// 消息类型
|
||||
network::http::message_type m_msg_type = HTTP_SERVER_MESSAGE_TYPE_NORMAL;
|
||||
// 是否为关闭连接包
|
||||
bool m_is_close = false;
|
||||
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user