From 3020bca1d98d049aa0c22ab19a2d0266cb7b8874 Mon Sep 17 00:00:00 2001 From: Bill Chan Date: Thu, 2 Sep 2021 10:31:57 +0200 Subject: [PATCH 1/8] set min iOS version to iOS 12 --- Starscream.xcodeproj/project.pbxproj | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Starscream.xcodeproj/project.pbxproj b/Starscream.xcodeproj/project.pbxproj index 4379a960..3948975f 100644 --- a/Starscream.xcodeproj/project.pbxproj +++ b/Starscream.xcodeproj/project.pbxproj @@ -447,7 +447,7 @@ DYLIB_INSTALL_NAME_BASE = "@rpath"; INFOPLIST_FILE = "$(SRCROOT)/Sources/Info.plist"; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 9.0; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; MACOSX_DEPLOYMENT_TARGET = 10.10; MARKETING_VERSION = 4.0.4; @@ -475,7 +475,7 @@ DYLIB_INSTALL_NAME_BASE = "@rpath"; INFOPLIST_FILE = "$(SRCROOT)/Sources/Info.plist"; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 9.0; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; MACOSX_DEPLOYMENT_TARGET = 10.10; MARKETING_VERSION = 4.0.4; @@ -540,7 +540,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 9.0; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; MTL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; SUPPORTED_PLATFORMS = "iphonesimulator iphoneos macosx appletvos appletvsimulator watchsimulator watchos"; @@ -593,7 +593,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 9.0; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; MTL_ENABLE_DEBUG_INFO = NO; SUPPORTED_PLATFORMS = "iphonesimulator iphoneos macosx appletvos appletvsimulator watchsimulator watchos"; SWIFT_VERSION = 5.0; From 9af772a2ca0dde90b3b9b8e7e778d337f4a84e91 Mon Sep 17 00:00:00 2001 From: Bill Chan Date: Thu, 2 Sep 2021 11:03:07 +0200 Subject: [PATCH 2/8] drop unnecessary archs --- Starscream.xcodeproj/project.pbxproj | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Starscream.xcodeproj/project.pbxproj b/Starscream.xcodeproj/project.pbxproj index 4379a960..622fdbf7 100644 --- a/Starscream.xcodeproj/project.pbxproj +++ b/Starscream.xcodeproj/project.pbxproj @@ -467,6 +467,8 @@ 33CCF0911F5DDC030099B092 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { + "ARCHS[sdk=iphoneos*]" = arm64; + "ARCHS[sdk=iphonesimulator*]" = x86_64; BITCODE_GENERATION_MODE = bitcode; CLANG_ENABLE_MODULES = YES; DEFINES_MODULE = YES; From 0011451243661aedb0745f880140eff70ae19d85 Mon Sep 17 00:00:00 2001 From: Bill Chan Date: Wed, 8 Sep 2021 14:05:36 +0200 Subject: [PATCH 3/8] drop iOS 12 --- Starscream.xcodeproj/project.pbxproj | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Starscream.xcodeproj/project.pbxproj b/Starscream.xcodeproj/project.pbxproj index 4379a960..3948975f 100644 --- a/Starscream.xcodeproj/project.pbxproj +++ b/Starscream.xcodeproj/project.pbxproj @@ -447,7 +447,7 @@ DYLIB_INSTALL_NAME_BASE = "@rpath"; INFOPLIST_FILE = "$(SRCROOT)/Sources/Info.plist"; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 9.0; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; MACOSX_DEPLOYMENT_TARGET = 10.10; MARKETING_VERSION = 4.0.4; @@ -475,7 +475,7 @@ DYLIB_INSTALL_NAME_BASE = "@rpath"; INFOPLIST_FILE = "$(SRCROOT)/Sources/Info.plist"; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 9.0; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; MACOSX_DEPLOYMENT_TARGET = 10.10; MARKETING_VERSION = 4.0.4; @@ -540,7 +540,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 9.0; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; MTL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; SUPPORTED_PLATFORMS = "iphonesimulator iphoneos macosx appletvos appletvsimulator watchsimulator watchos"; @@ -593,7 +593,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 9.0; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; MTL_ENABLE_DEBUG_INFO = NO; SUPPORTED_PLATFORMS = "iphonesimulator iphoneos macosx appletvos appletvsimulator watchsimulator watchos"; SWIFT_VERSION = 5.0; From b926234e3b3f23f8439ac3c780ed97b7e4369375 Mon Sep 17 00:00:00 2001 From: Bill Chan Date: Wed, 8 Sep 2021 14:07:03 +0200 Subject: [PATCH 4/8] drop armv7 --- Starscream.xcodeproj/project.pbxproj | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Starscream.xcodeproj/project.pbxproj b/Starscream.xcodeproj/project.pbxproj index 3948975f..34f4ec85 100644 --- a/Starscream.xcodeproj/project.pbxproj +++ b/Starscream.xcodeproj/project.pbxproj @@ -467,6 +467,8 @@ 33CCF0911F5DDC030099B092 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { + "ARCHS[sdk=iphoneos*]" = arm64; + "ARCHS[sdk=iphonesimulator*]" = x86_64; BITCODE_GENERATION_MODE = bitcode; CLANG_ENABLE_MODULES = YES; DEFINES_MODULE = YES; From b4923726c7dcf06850dd06e31b2727994ad88ce9 Mon Sep 17 00:00:00 2001 From: Bill Chan Date: Wed, 17 Nov 2021 17:45:55 +0100 Subject: [PATCH 5/8] add arm64 simulator --- Starscream.xcodeproj/project.pbxproj | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Starscream.xcodeproj/project.pbxproj b/Starscream.xcodeproj/project.pbxproj index 34f4ec85..682ed4bb 100644 --- a/Starscream.xcodeproj/project.pbxproj +++ b/Starscream.xcodeproj/project.pbxproj @@ -468,7 +468,10 @@ isa = XCBuildConfiguration; buildSettings = { "ARCHS[sdk=iphoneos*]" = arm64; - "ARCHS[sdk=iphonesimulator*]" = x86_64; + "ARCHS[sdk=iphonesimulator*]" = ( + x86_64, + arm64, + ); BITCODE_GENERATION_MODE = bitcode; CLANG_ENABLE_MODULES = YES; DEFINES_MODULE = YES; From b5eec2dc256b91ed85198694cd25c44649c55c60 Mon Sep 17 00:00:00 2001 From: Bill Chan Date: Tue, 30 Nov 2021 17:25:09 +0100 Subject: [PATCH 6/8] fix: set the Skip Install property to NO. After doing this, Xcode includes the .swiftmodule in your product when you archive it, making your framework "module stable". --- Starscream.xcodeproj/project.pbxproj | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Starscream.xcodeproj/project.pbxproj b/Starscream.xcodeproj/project.pbxproj index 34f4ec85..49cf1fc5 100644 --- a/Starscream.xcodeproj/project.pbxproj +++ b/Starscream.xcodeproj/project.pbxproj @@ -454,7 +454,7 @@ OTHER_LDFLAGS = "-all_load"; PRODUCT_BUNDLE_IDENTIFIER = "com.vluxe.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; - SKIP_INSTALL = YES; + SKIP_INSTALL = NO; SUPPORTS_MACCATALYST = YES; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; SWIFT_SWIFT3_OBJC_INFERENCE = Off; @@ -484,7 +484,7 @@ OTHER_LDFLAGS = "-all_load"; PRODUCT_BUNDLE_IDENTIFIER = "com.vluxe.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; - SKIP_INSTALL = YES; + SKIP_INSTALL = NO; SUPPORTS_MACCATALYST = YES; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; SWIFT_SWIFT3_OBJC_INFERENCE = Off; From a69500ae71d201c6a0ec012fe6961791754d1147 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Benaiteau?= Date: Tue, 22 Nov 2022 15:57:52 +0100 Subject: [PATCH 7/8] feat: expose URLSessionConfiguration set proxy to it --- Sources/Starscream/WebSocket.swift | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Sources/Starscream/WebSocket.swift b/Sources/Starscream/WebSocket.swift index f09df584..82018dbe 100644 --- a/Sources/Starscream/WebSocket.swift +++ b/Sources/Starscream/WebSocket.swift @@ -97,6 +97,7 @@ open class WebSocket: WebSocketClient, EngineDelegate { public var onEvent: ((WebSocketEvent) -> Void)? public var request: URLRequest + public var configuration: URLSessionConfiguration? = nil // Where the callback is executed. It defaults to the main UI thread queue. public var callbackQueue = DispatchQueue.main public var respondToPingWithPong: Bool { @@ -127,7 +128,7 @@ open class WebSocket: WebSocketClient, EngineDelegate { public func connect() { engine.register(delegate: self) - engine.start(request: request) + engine.start(request: request, configuration: self.configuration) } public func disconnect(closeCode: UInt16 = CloseCode.normal.rawValue) { From 90135dbe5c6006202aa41bd83549a181272496e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Benaiteau?= Date: Tue, 22 Nov 2022 16:15:57 +0100 Subject: [PATCH 8/8] passing configuration to NativeEngine --- Sources/Engine/Engine.swift | 2 +- Sources/Engine/NativeEngine.swift | 5 +++-- Sources/Engine/WSEngine.swift | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/Sources/Engine/Engine.swift b/Sources/Engine/Engine.swift index a60ef7e8..a8b723f2 100644 --- a/Sources/Engine/Engine.swift +++ b/Sources/Engine/Engine.swift @@ -14,7 +14,7 @@ public protocol EngineDelegate: class { public protocol Engine { func register(delegate: EngineDelegate) - func start(request: URLRequest) + func start(request: URLRequest, configuration: URLSessionConfiguration?) func stop(closeCode: UInt16) func forceStop() func write(data: Data, opcode: FrameOpCode, completion: (() -> ())?) diff --git a/Sources/Engine/NativeEngine.swift b/Sources/Engine/NativeEngine.swift index 1bd5b6a8..92dc1161 100644 --- a/Sources/Engine/NativeEngine.swift +++ b/Sources/Engine/NativeEngine.swift @@ -17,8 +17,9 @@ public class NativeEngine: NSObject, Engine, URLSessionDataDelegate, URLSessionW self.delegate = delegate } - public func start(request: URLRequest) { - let session = URLSession(configuration: URLSessionConfiguration.default, delegate: self, delegateQueue: nil) + public func start(request: URLRequest, configuration: URLSessionConfiguration?) { + let sessionConfiguration: URLSessionConfiguration = configuration ?? URLSessionConfiguration.default + let session = URLSession(configuration: sessionConfiguration, delegate: self, delegateQueue: nil) task = session.webSocketTask(with: request) doRead() task?.resume() diff --git a/Sources/Engine/WSEngine.swift b/Sources/Engine/WSEngine.swift index decca641..f6c36d1a 100644 --- a/Sources/Engine/WSEngine.swift +++ b/Sources/Engine/WSEngine.swift @@ -48,7 +48,7 @@ FrameCollectorDelegate, HTTPHandlerDelegate { self.delegate = delegate } - public func start(request: URLRequest) { + public func start(request: URLRequest, configuration: URLSessionConfiguration?) { mutex.wait() let isConnected = canSend mutex.signal()