cpp-mirai-client  v2.6.1
cpp client for mirai-api-http
HttpWsAdaptor.hpp
浏览该文件的文档.
1// Copyright (C) 2022 Numendacil and contributors
2//
3// This program is free software: you can redistribute it and/or modify
4// it under the terms of the GNU Affero General Public License as
5// published by the Free Software Foundation, either version 3 of the
6// License, or (at your option) any later version.
7//
8// This program is distributed in the hope that it will be useful,
9// but WITHOUT ANY WARRANTY; without even the implied warranty of
10// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11// GNU Affero General Public License for more details.
12//
13// You should have received a copy of the GNU Affero General Public License
14// along with this program. If not, see <http://www.gnu.org/licenses/>.
15
16#ifndef MIRAI_HTTP_WEBSOCKET_ADAPTOR_HPP_
17#define MIRAI_HTTP_WEBSOCKET_ADAPTOR_HPP_
18
19#include <memory>
20
21#include "IAdaptor.hpp"
22
23/// 所有mirai相关的对象的命名空间
24namespace Mirai
25{
26
28{
29 /// Http adapter地址
30 std::string HttpUrl = "http://localhost:8080";
31 /// 连接超时时间
32 std::chrono::milliseconds ConnectionTimeout = std::chrono::seconds(30);
33 /// 读取超时时间
34 std::chrono::milliseconds ReadTimeout = std::chrono::seconds(5);
35 /// 写入超时时间
36 std::chrono::milliseconds WriteTimeout = std::chrono::seconds(5);
37
38 /// Websocket adapter地址
39 std::string WebsocketUrl = "ws://localhost:8080";
40 /// 心跳信息间隔
41 std::chrono::seconds HeartbeatInterval = std::chrono::seconds(60);
42 /// 握手超时时间
43 std::chrono::seconds HandshakeTimeout = std::chrono::seconds(60);
44 /// 开启自动回复ping
45 bool EnablePong = true;
46 /// 开启数据压缩
48#ifdef IXWEBSOCKET_USE_ZLIB
49 true
50#else
51 false
52#endif
53 ;
54 /// 开启自动重连
55 bool AutoReconnect = true;
56 /// 最小重连时间间隔
57 std::chrono::milliseconds MinRetryInterval = std::chrono::seconds(1);
58 /// 最大重连时间间隔
59 std::chrono::milliseconds MaxRetryInterval = std::chrono::seconds(30);
60
61 /// BotQQ
62 QQ_t BotQQ = 12345_qq;
63 /// 验证密钥
64 std::string VerifyKey = "";
65
66 /// 从JSON文件中读取配置
67 void FromJsonFile(const std::string& path);
68
69 /// 从TOML文件中读取配置
70 void FromTOMLFile(const std::string& path);
71};
72
73std::unique_ptr<IAdaptor> MakeHttpWsAdaptor(HttpWsAdaptorConfig config);
74
75} // namespace Mirai
76
77#endif
QQ号码类型
Definition: BasicTypes.hpp:71
所有mirai相关的对象的命名空间
std::unique_ptr< IAdaptor > MakeHttpWsAdaptor(HttpWsAdaptorConfig config)
std::string HttpUrl
Http adapter地址
bool AutoReconnect
开启自动重连
void FromJsonFile(const std::string &path)
从JSON文件中读取配置
std::chrono::milliseconds ConnectionTimeout
连接超时时间
std::chrono::milliseconds WriteTimeout
写入超时时间
bool EnableDeflate
开启数据压缩
std::chrono::seconds HeartbeatInterval
心跳信息间隔
bool EnablePong
开启自动回复ping
std::chrono::milliseconds MinRetryInterval
最小重连时间间隔
std::chrono::seconds HandshakeTimeout
握手超时时间
std::string VerifyKey
验证密钥
std::chrono::milliseconds ReadTimeout
读取超时时间
std::chrono::milliseconds MaxRetryInterval
最大重连时间间隔
std::string WebsocketUrl
Websocket adapter地址
void FromTOMLFile(const std::string &path)
从TOML文件中读取配置