Skip to content

Commit 015bf6f

Browse files
committed
added set_tls_verifier_callback
1 parent 3b7be7e commit 015bf6f

File tree

3 files changed

+26
-0
lines changed

3 files changed

+26
-0
lines changed

src/internal/sio_client_impl.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ namespace sio
8787

8888
#undef SYNTHESIS_SETTER
8989

90+
9091

9192
void clear_con_listeners()
9293
{
@@ -188,6 +189,14 @@ namespace sio
188189
void update_ping_timeout_timer();
189190

190191
#if SIO_TLS
192+
std::function<bool(bool, websocketpp::lib::asio::ssl::verify_context&)> verify_callback_cb;
193+
194+
template <typename VerifyCallback>
195+
void set_tls_verify_callback(VerifyCallback callback)
196+
{
197+
verify_callback_cb = callback;
198+
}
199+
191200
typedef websocketpp::lib::shared_ptr<asio::ssl::context> context_ptr;
192201

193202
context_ptr on_tls_init(connection_hdl con);

src/sio_client.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,15 @@ namespace sio
7474
m_impl->set_proxy_basic_auth(uri, username, password);
7575
}
7676

77+
#if SIO_TLS
78+
void client::set_tls_verify_callback(std::function<bool(bool, websocketpp::lib::asio::ssl::verify_context&)> callback)
79+
{
80+
if (m_impl) {
81+
m_impl->set_tls_verify_callback(callback);
82+
}
83+
}
84+
#endif
85+
7786
void client::connect(const std::string& uri)
7887
{
7988
m_impl->connect(uri, {}, {}, {});

src/sio_client.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@
1111
#include "sio_message.h"
1212
#include "sio_socket.h"
1313

14+
#if SIO_TLS
15+
#include "websocketpp/config/asio_client.hpp"
16+
#endif
17+
1418
namespace asio {
1519
class io_context;
1620
}
@@ -61,6 +65,10 @@ namespace sio
6165
void clear_con_listeners();
6266

6367
void clear_socket_listeners();
68+
69+
#if SIO_TLS
70+
void set_tls_verify_callback(std::function<bool(bool, websocketpp::lib::asio::ssl::verify_context&)> callback);
71+
#endif
6472

6573
// Client Functions - such as send, etc.
6674
void connect(const std::string& uri);

0 commit comments

Comments
 (0)