From 3b037f2e3b5d806e2a8979dab512488bd68ad5f1 Mon Sep 17 00:00:00 2001 From: Dobby Date: Sat, 22 May 2021 16:11:50 +0200 Subject: [PATCH 1/3] Added TLS support (only) --- .../Private/internal/sio_client_impl.cpp | 4 +++- .../Private/internal/sio_client_impl.h | 18 ++++++++++++++---- Source/SocketIOLib/SocketIOLib.Build.cs | 14 ++++++++++++-- 3 files changed, 29 insertions(+), 7 deletions(-) diff --git a/Source/SocketIOLib/Private/internal/sio_client_impl.cpp b/Source/SocketIOLib/Private/internal/sio_client_impl.cpp index 1e2576b6..18bc91c3 100644 --- a/Source/SocketIOLib/Private/internal/sio_client_impl.cpp +++ b/Source/SocketIOLib/Private/internal/sio_client_impl.cpp @@ -629,7 +629,7 @@ namespace sio #if SIO_TLS client_impl::context_ptr client_impl::on_tls_init(connection_hdl conn) { - context_ptr ctx = context_ptr(new asio::ssl::context(asio::ssl::context::tlsv1)); + context_ptr ctx = context_ptr(new asio::ssl::context(asio::ssl::context::tlsv12)); asio::error_code ec; ctx->set_options(asio::ssl::context::default_workarounds | asio::ssl::context::no_sslv2 | @@ -639,6 +639,8 @@ namespace sio cerr << "Init tls failed,reason:" << ec.message() << endl; } + ctx->set_verify_mode(asio::ssl::verify_none); + return ctx; } #endif diff --git a/Source/SocketIOLib/Private/internal/sio_client_impl.h b/Source/SocketIOLib/Private/internal/sio_client_impl.h index 150324ed..90ec0783 100644 --- a/Source/SocketIOLib/Private/internal/sio_client_impl.h +++ b/Source/SocketIOLib/Private/internal/sio_client_impl.h @@ -36,16 +36,26 @@ #if defined(DEBUG) #if SIO_TLS - #include - typedef websocketpp::config::debug_asio_tls client_config; + #define UI UI_ST + THIRD_PARTY_INCLUDES_START + #include "openssl/hmac.h" + #include + typedef websocketpp::config::debug_asio_tls client_config; + THIRD_PARTY_INCLUDES_END + #undef UI #else #include typedef websocketpp::config::debug_asio client_config; #endif //SIO_TLS #else #if defined(SIO_TLS) - #include - typedef websocketpp::config::asio_tls_client client_config; + #define UI UI_ST + THIRD_PARTY_INCLUDES_START + #include "openssl/hmac.h" + #include + typedef websocketpp::config::asio_tls_client client_config; + THIRD_PARTY_INCLUDES_END + #undef UI #else #include typedef websocketpp::config::asio_client client_config; diff --git a/Source/SocketIOLib/SocketIOLib.Build.cs b/Source/SocketIOLib/SocketIOLib.Build.cs index 5c40d6d3..de02cd0f 100644 --- a/Source/SocketIOLib/SocketIOLib.Build.cs +++ b/Source/SocketIOLib/SocketIOLib.Build.cs @@ -50,15 +50,25 @@ public SocketIOLib(ReadOnlyTargetRules Target) : base(Target) { "CoreUObject", "Engine", + "OpenSSL" } ); - - DynamicallyLoadedModuleNames.AddRange( + DynamicallyLoadedModuleNames.AddRange( new string[] { } ); + + //Setup TLS support + if (Target.Platform == UnrealTargetPlatform.Win64 || + Target.Platform == UnrealTargetPlatform.Win32 || + Target.Platform == UnrealTargetPlatform.Mac || + Target.Platform == UnrealTargetPlatform.IOS + ) + { + PublicDefinitions.Add("SIO_TLS"); + } } } } \ No newline at end of file From 0d3420f626704802d457e125bf01d0d4d26bbfe3 Mon Sep 17 00:00:00 2001 From: Dobby Date: Sun, 23 May 2021 15:33:27 +0200 Subject: [PATCH 2/3] SSL support declaration --- Source/SocketIOLib/SocketIOLib.Build.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Source/SocketIOLib/SocketIOLib.Build.cs b/Source/SocketIOLib/SocketIOLib.Build.cs index de02cd0f..9474dd70 100644 --- a/Source/SocketIOLib/SocketIOLib.Build.cs +++ b/Source/SocketIOLib/SocketIOLib.Build.cs @@ -60,7 +60,8 @@ public SocketIOLib(ReadOnlyTargetRules Target) : base(Target) } ); - //Setup TLS support + /* + //Setup TLS support | Maybe other platforms work as well (untested) if (Target.Platform == UnrealTargetPlatform.Win64 || Target.Platform == UnrealTargetPlatform.Win32 || Target.Platform == UnrealTargetPlatform.Mac || @@ -69,6 +70,7 @@ public SocketIOLib(ReadOnlyTargetRules Target) : base(Target) { PublicDefinitions.Add("SIO_TLS"); } + */ } } } \ No newline at end of file From efbb6f37a3aeb5bf256e4db376c365c619cbeef7 Mon Sep 17 00:00:00 2001 From: Dobby Date: Sun, 23 May 2021 15:44:45 +0200 Subject: [PATCH 3/3] Update README.md Added compatibility table and ssl description --- README.md | 29 ++++++++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 0e780249..581d7371 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ Socket.IO Lib uses _asio_, _rapidjson_, and _websocketpp_. SIOJson is originally [Unreal Forum Thread](https://forums.unrealengine.com/showthread.php?110680-Plugin-Socket-io-Client) -Recommended socket.io server version: 1.4+. +Recommended socket.io server version: 3.0+ *Tip: This is a sizeable readme, quickly find your topic with ```Ctrl+F``` and a search term e.g. namespaces* @@ -22,8 +22,31 @@ Current platform issues: * Xbox/PS4 platform untested - see [issue 117](https://github.com/getnamo/socketio-client-ue4/issues/117) * Lumin platform untested - see [issue 114](https://github.com/getnamo/socketio-client-ue4/issues/114) -HTTPS currently not yet supported -* OpenSSL Support - [issue39](https://github.com/getnamo/socketio-client-ue4/issues/39), temporary [workaround available](https://github.com/getnamo/socketio-client-ue4/issues/72#issuecomment-371956821). +HTTPS is only supported through a little change in the source code. +* OpenSSL Support - Remove this declaration and compile the code, that's all. + +## Compatibility table + + + + + + + + + + + + + + + + + + + + +
UE4 Socket.IO plugin versionSocket.IO server version
1.x / 2.x3.x / 4.x
Up to tag 1.5.5YESNO
1.6+ (master branch)NOYES
## Quick Install & Setup ##