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() 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) { diff --git a/Starscream.xcodeproj/project.pbxproj b/Starscream.xcodeproj/project.pbxproj index 4379a960..d80dfcc7 100644 --- a/Starscream.xcodeproj/project.pbxproj +++ b/Starscream.xcodeproj/project.pbxproj @@ -447,14 +447,14 @@ 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; 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; @@ -467,6 +467,11 @@ 33CCF0911F5DDC030099B092 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { + "ARCHS[sdk=iphoneos*]" = arm64; + "ARCHS[sdk=iphonesimulator*]" = ( + x86_64, + arm64, + ); BITCODE_GENERATION_MODE = bitcode; CLANG_ENABLE_MODULES = YES; DEFINES_MODULE = YES; @@ -475,14 +480,14 @@ 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; 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; @@ -540,7 +545,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 +598,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;