Compare commits

..

No commits in common. "master" and "v16.0.0" have entirely different histories.

26 changed files with 148 additions and 349 deletions

View File

@ -1,19 +0,0 @@
name: Swift
on:
push:
branches: [ "master", "development" ]
pull_request:
branches: [ "master", "development" ]
jobs:
build:
runs-on: macos-latest
steps:
- uses: actions/checkout@v3
- name: Build
run: swift build -v
- name: Run tests
run: swift test -v

2
.gitignore vendored
View File

@ -50,5 +50,3 @@ Socket.IO-Test-Server/node_modules/*
.idea/ .idea/
docs/docsets/ docs/docsets/
docs/undocumented.json docs/undocumented.json
.swiftpm

View File

@ -1,7 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
<FileRef
location = "self:">
</FileRef>
</Workspace>

18
.travis.yml Normal file
View File

@ -0,0 +1,18 @@
language: objective-c
xcode_project: Socket.IO-Client-Swift.xcodeproj # path to your xcodeproj folder
xcode_scheme: SocketIO-Mac
osx_image: xcode12.2
branches:
only:
- master
- development
before_install:
# - brew update
# - brew outdated xctool || brew upgrade xctool
# - brew outdated carthage || brew upgrade carthage
- carthage update --platform macosx
script:
- xcodebuild -project Socket.IO-Client-Swift.xcodeproj -scheme SocketIO build test -quiet
# - xcodebuild -project Socket.IO-Client-Swift.xcodeproj -scheme SocketIO build-for-testing -quiet
# - xctool -project Socket.IO-Client-Swift.xcodeproj -scheme SocketIO run-tests --parallelize
- swift test

View File

@ -1,8 +1,3 @@
# v16.1.0
- Remove support for iOS 11.
- Update to Starscream 4.0.6
# v16.0.0 # v16.0.0
- Removed Objective-C support. It's time for you to embrace Swift. - Removed Objective-C support. It's time for you to embrace Swift.

View File

@ -1 +1 @@
github "daltoniam/Starscream" ~> 4.0.8 github "daltoniam/Starscream" ~> 4.0

View File

@ -1 +1 @@
github "daltoniam/Starscream" "4.0.8" github "daltoniam/Starscream" "4.0.4"

View File

@ -6,8 +6,8 @@
"repositoryURL": "https://github.com/daltoniam/Starscream", "repositoryURL": "https://github.com/daltoniam/Starscream",
"state": { "state": {
"branch": null, "branch": null,
"revision": "c6bfd1af48efcc9a9ad203665db12375ba6b145a", "revision": "df8d82047f6654d8e4b655d1b1525c64e1059d21",
"version": "4.0.8" "version": "4.0.4"
} }
} }
] ]

View File

@ -1,4 +1,4 @@
// swift-tools-version:5.4 // swift-tools-version:5.3
import PackageDescription import PackageDescription
@ -8,7 +8,7 @@ let package = Package(
.library(name: "SocketIO", targets: ["SocketIO"]) .library(name: "SocketIO", targets: ["SocketIO"])
], ],
dependencies: [ dependencies: [
.package(url: "https://github.com/daltoniam/Starscream", .upToNextMajor(from: "4.0.8")), .package(url: "https://github.com/daltoniam/Starscream", .upToNextMinor(from: "4.0.0")),
], ],
targets: [ targets: [
.target(name: "SocketIO", dependencies: ["Starscream"]), .target(name: "SocketIO", dependencies: ["Starscream"]),

View File

@ -18,7 +18,7 @@ socket.on("currentAmount") {data, ack in
guard let cur = data[0] as? Double else { return } guard let cur = data[0] as? Double else { return }
socket.emitWithAck("canUpdate", cur).timingOut(after: 0) {data in socket.emitWithAck("canUpdate", cur).timingOut(after: 0) {data in
if data.first as? String ?? "passed" == SocketAckStatus.noAck { if data.first as? String ?? "passed" == SocketAckValue.noAck {
// Handle ack timeout // Handle ack timeout
} }
@ -32,7 +32,7 @@ socket.connect()
``` ```
## Features ## Features
- Supports Socket.IO server 2.0+/3.0+/4.0+ (see the [compatibility table](https://nuclearace.github.io/Socket.IO-Client-Swift/Compatibility.html)) - Supports socket.io 2.0+/3.0+.
- Supports Binary - Supports Binary
- Supports Polling and WebSockets - Supports Polling and WebSockets
- Supports TLS/SSL - Supports TLS/SSL
@ -61,7 +61,7 @@ let package = Package(
.executable(name: "socket.io-test", targets: ["YourTargetName"]) .executable(name: "socket.io-test", targets: ["YourTargetName"])
], ],
dependencies: [ dependencies: [
.package(url: "https://github.com/socketio/socket.io-client-swift", .upToNextMinor(from: "16.1.1")) .package(url: "https://github.com/socketio/socket.io-client-swift", .upToNextMinor(from: "15.0.0"))
], ],
targets: [ targets: [
.target(name: "YourTargetName", dependencies: ["SocketIO"], path: "./Path/To/Your/Sources") .target(name: "YourTargetName", dependencies: ["SocketIO"], path: "./Path/To/Your/Sources")
@ -74,7 +74,7 @@ Then import `import SocketIO`.
### Carthage ### Carthage
Add this line to your `Cartfile`: Add this line to your `Cartfile`:
``` ```
github "socketio/socket.io-client-swift" ~> 16.1.1 github "socketio/socket.io-client-swift" ~> 15.2.0
``` ```
Run `carthage update --platform ios,macosx`. Run `carthage update --platform ios,macosx`.
@ -88,7 +88,7 @@ Create `Podfile` and add `pod 'Socket.IO-Client-Swift'`:
use_frameworks! use_frameworks!
target 'YourApp' do target 'YourApp' do
pod 'Socket.IO-Client-Swift', '~> 16.1.1' pod 'Socket.IO-Client-Swift', '~> 15.2.0'
end end
``` ```

View File

@ -1,7 +1,7 @@
Pod::Spec.new do |s| Pod::Spec.new do |s|
s.name = "Socket.IO-Client-Swift" s.name = "Socket.IO-Client-Swift"
s.module_name = "SocketIO" s.module_name = "SocketIO"
s.version = "16.1.1" s.version = "16.0.0"
s.summary = "Socket.IO-client for iOS and OS X" s.summary = "Socket.IO-client for iOS and OS X"
s.description = <<-DESC s.description = <<-DESC
Socket.IO-client for iOS and OS X. Socket.IO-client for iOS and OS X.
@ -11,21 +11,21 @@ Pod::Spec.new do |s|
s.homepage = "https://github.com/socketio/socket.io-client-swift" s.homepage = "https://github.com/socketio/socket.io-client-swift"
s.license = { :type => 'MIT' } s.license = { :type => 'MIT' }
s.author = { "Erik" => "nuclear.ace@gmail.com" } s.author = { "Erik" => "nuclear.ace@gmail.com" }
s.ios.deployment_target = '12.0' s.ios.deployment_target = '10.0'
s.osx.deployment_target = '10.13' s.osx.deployment_target = '10.13'
s.tvos.deployment_target = '12.0' s.tvos.deployment_target = '10.0'
s.watchos.deployment_target = '5.0' s.watchos.deployment_target = '5.0'
s.requires_arc = true s.requires_arc = true
s.source = { s.source = {
:git => "https://github.com/socketio/socket.io-client-swift.git", :git => "https://github.com/socketio/socket.io-client-swift.git",
:tag => 'v16.1.1', :tag => 'v16.0.0',
:submodules => true :submodules => true
} }
s.swift_version = "5" s.swift_version = "5"
s.pod_target_xcconfig = { s.pod_target_xcconfig = {
'SWIFT_VERSION' => '5.4' 'SWIFT_VERSION' => '5.0'
} }
s.source_files = "Source/SocketIO/**/*.swift", "Source/SocketIO/*.swift" s.source_files = "Source/SocketIO/**/*.swift", "Source/SocketIO/*.swift"
s.dependency "Starscream", "~> 4.0.8" s.dependency "Starscream", "~> 4.0"
end end

View File

@ -3,7 +3,7 @@
archiveVersion = 1; archiveVersion = 1;
classes = { classes = {
}; };
objectVersion = 54; objectVersion = 46;
objects = { objects = {
/* Begin PBXBuildFile section */ /* Begin PBXBuildFile section */
@ -19,9 +19,9 @@
1C686BE71F869AFD007D8627 /* SocketParserTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1C686BD71F869AF1007D8627 /* SocketParserTest.swift */; }; 1C686BE71F869AFD007D8627 /* SocketParserTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1C686BD71F869AF1007D8627 /* SocketParserTest.swift */; };
1C686BE81F869AFD007D8627 /* SocketNamespacePacketTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1C686BD81F869AF1007D8627 /* SocketNamespacePacketTest.swift */; }; 1C686BE81F869AFD007D8627 /* SocketNamespacePacketTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1C686BD81F869AF1007D8627 /* SocketNamespacePacketTest.swift */; };
572EF2431B51F18A00EEBB58 /* SocketIO.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 572EF2381B51F18A00EEBB58 /* SocketIO.framework */; }; 572EF2431B51F18A00EEBB58 /* SocketIO.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 572EF2381B51F18A00EEBB58 /* SocketIO.framework */; };
579C7D4C2731B487009F8A2F /* Starscream.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = 579C7D4B2731B487009F8A2F /* Starscream.xcframework */; };
6CA08A981D615C0B0061FD2A /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6CA08A971D615C0B0061FD2A /* Security.framework */; }; 6CA08A981D615C0B0061FD2A /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6CA08A971D615C0B0061FD2A /* Security.framework */; };
74BF53581F894326004972D8 /* SocketIO.h in Headers */ = {isa = PBXBuildFile; fileRef = 572EF23C1B51F18A00EEBB58 /* SocketIO.h */; settings = {ATTRIBUTES = (Public, ); }; }; 74BF53581F894326004972D8 /* SocketIO.h in Headers */ = {isa = PBXBuildFile; fileRef = 572EF23C1B51F18A00EEBB58 /* SocketIO.h */; settings = {ATTRIBUTES = (Public, ); }; };
74D0F5961F8053950037C4DC /* Starscream.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9432E00B1F77F883006AF628 /* Starscream.framework */; };
74DA21741F09440F009C19EE /* libz.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 74DA21731F09440F009C19EE /* libz.tbd */; }; 74DA21741F09440F009C19EE /* libz.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 74DA21731F09440F009C19EE /* libz.tbd */; };
74DA217C1F09457B009C19EE /* libz.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 74DA21731F09440F009C19EE /* libz.tbd */; }; 74DA217C1F09457B009C19EE /* libz.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 74DA21731F09440F009C19EE /* libz.tbd */; };
DD52B048C71D724ABBD18C71 /* SocketTypes.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD52BDC9E66AADA2CC5E8246 /* SocketTypes.swift */; }; DD52B048C71D724ABBD18C71 /* SocketTypes.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD52BDC9E66AADA2CC5E8246 /* SocketTypes.swift */; };
@ -75,15 +75,18 @@
572EF23B1B51F18A00EEBB58 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; }; 572EF23B1B51F18A00EEBB58 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
572EF23C1B51F18A00EEBB58 /* SocketIO.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SocketIO.h; sourceTree = "<group>"; }; 572EF23C1B51F18A00EEBB58 /* SocketIO.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SocketIO.h; sourceTree = "<group>"; };
572EF2421B51F18A00EEBB58 /* SocketIO-Tests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "SocketIO-Tests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; }; 572EF2421B51F18A00EEBB58 /* SocketIO-Tests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "SocketIO-Tests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; };
579C7D4B2731B487009F8A2F /* Starscream.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; name = Starscream.xcframework; path = Carthage/Build/Starscream.xcframework; sourceTree = "<group>"; };
6CA08A951D615C040061FD2A /* Security.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Security.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS9.3.sdk/System/Library/Frameworks/Security.framework; sourceTree = DEVELOPER_DIR; }; 6CA08A951D615C040061FD2A /* Security.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Security.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS9.3.sdk/System/Library/Frameworks/Security.framework; sourceTree = DEVELOPER_DIR; };
6CA08A971D615C0B0061FD2A /* Security.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Security.framework; path = System/Library/Frameworks/Security.framework; sourceTree = SDKROOT; }; 6CA08A971D615C0B0061FD2A /* Security.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Security.framework; path = System/Library/Frameworks/Security.framework; sourceTree = SDKROOT; };
6CA08A991D615C140061FD2A /* Security.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Security.framework; path = Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS9.2.sdk/System/Library/Frameworks/Security.framework; sourceTree = DEVELOPER_DIR; }; 6CA08A991D615C140061FD2A /* Security.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Security.framework; path = Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS9.2.sdk/System/Library/Frameworks/Security.framework; sourceTree = DEVELOPER_DIR; };
749FA19F1F8112E7002FBB30 /* Starscream.framework.dSYM */ = {isa = PBXFileReference; lastKnownFileType = wrapper.dsym; name = Starscream.framework.dSYM; path = Carthage/Build/Mac/Starscream.framework.dSYM; sourceTree = "<group>"; };
749FA1A11F811408002FBB30 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; 749FA1A11F811408002FBB30 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
74D0F58D1F804FED0037C4DC /* libz.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libz.tbd; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.0.sdk/usr/lib/libz.tbd; sourceTree = DEVELOPER_DIR; }; 74D0F58D1F804FED0037C4DC /* libz.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libz.tbd; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.0.sdk/usr/lib/libz.tbd; sourceTree = DEVELOPER_DIR; };
74DA21731F09440F009C19EE /* libz.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libz.tbd; path = usr/lib/libz.tbd; sourceTree = SDKROOT; }; 74DA21731F09440F009C19EE /* libz.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libz.tbd; path = usr/lib/libz.tbd; sourceTree = SDKROOT; };
74DA217D1F0945E9009C19EE /* libcommonCrypto.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libcommonCrypto.tbd; path = usr/lib/system/libcommonCrypto.tbd; sourceTree = SDKROOT; }; 74DA217D1F0945E9009C19EE /* libcommonCrypto.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libcommonCrypto.tbd; path = usr/lib/system/libcommonCrypto.tbd; sourceTree = SDKROOT; };
9432E0061F77F7CA006AF628 /* SSLSecurity.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SSLSecurity.swift; sourceTree = "<group>"; }; 9432E0061F77F7CA006AF628 /* SSLSecurity.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SSLSecurity.swift; sourceTree = "<group>"; };
9432E0091F77F87D006AF628 /* Starscream.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Starscream.framework; path = Carthage/Build/iOS/Starscream.framework; sourceTree = "<group>"; };
9432E00B1F77F883006AF628 /* Starscream.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Starscream.framework; path = Carthage/Build/Mac/Starscream.framework; sourceTree = "<group>"; };
9432E00D1F77F889006AF628 /* Starscream.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Starscream.framework; path = Carthage/Build/tvOS/Starscream.framework; sourceTree = "<group>"; };
DD52B078DB0A3C3D1BB507CD /* SocketIOClientOption.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SocketIOClientOption.swift; sourceTree = "<group>"; }; DD52B078DB0A3C3D1BB507CD /* SocketIOClientOption.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SocketIOClientOption.swift; sourceTree = "<group>"; };
DD52B09F7984E730513AB7E5 /* SocketAckManager.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SocketAckManager.swift; sourceTree = "<group>"; }; DD52B09F7984E730513AB7E5 /* SocketAckManager.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SocketAckManager.swift; sourceTree = "<group>"; };
DD52B1D9BC4AE46D38D827DE /* SocketIOStatus.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SocketIOStatus.swift; sourceTree = "<group>"; }; DD52B1D9BC4AE46D38D827DE /* SocketIOStatus.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SocketIOStatus.swift; sourceTree = "<group>"; };
@ -117,8 +120,8 @@
buildActionMask = 2147483647; buildActionMask = 2147483647;
files = ( files = (
74DA21741F09440F009C19EE /* libz.tbd in Frameworks */, 74DA21741F09440F009C19EE /* libz.tbd in Frameworks */,
579C7D4C2731B487009F8A2F /* Starscream.xcframework in Frameworks */,
6CA08A981D615C0B0061FD2A /* Security.framework in Frameworks */, 6CA08A981D615C0B0061FD2A /* Security.framework in Frameworks */,
74D0F5961F8053950037C4DC /* Starscream.framework in Frameworks */,
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
}; };
@ -228,8 +231,11 @@
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
749FA1A11F811408002FBB30 /* Foundation.framework */, 749FA1A11F811408002FBB30 /* Foundation.framework */,
579C7D4B2731B487009F8A2F /* Starscream.xcframework */, 749FA19F1F8112E7002FBB30 /* Starscream.framework.dSYM */,
74D0F58D1F804FED0037C4DC /* libz.tbd */, 74D0F58D1F804FED0037C4DC /* libz.tbd */,
9432E0091F77F87D006AF628 /* Starscream.framework */,
9432E00B1F77F883006AF628 /* Starscream.framework */,
9432E00D1F77F889006AF628 /* Starscream.framework */,
74DA217D1F0945E9009C19EE /* libcommonCrypto.tbd */, 74DA217D1F0945E9009C19EE /* libcommonCrypto.tbd */,
74DA21731F09440F009C19EE /* libz.tbd */, 74DA21731F09440F009C19EE /* libz.tbd */,
6CA08A9E1D615C340061FD2A /* tvOS */, 6CA08A9E1D615C340061FD2A /* tvOS */,
@ -344,9 +350,9 @@
isa = PBXNativeTarget; isa = PBXNativeTarget;
buildConfigurationList = 572EF24B1B51F18A00EEBB58 /* Build configuration list for PBXNativeTarget "SocketIO" */; buildConfigurationList = 572EF24B1B51F18A00EEBB58 /* Build configuration list for PBXNativeTarget "SocketIO" */;
buildPhases = ( buildPhases = (
572EF2351B51F18A00EEBB58 /* Headers */,
572EF2331B51F18A00EEBB58 /* Sources */, 572EF2331B51F18A00EEBB58 /* Sources */,
572EF2341B51F18A00EEBB58 /* Frameworks */, 572EF2341B51F18A00EEBB58 /* Frameworks */,
572EF2351B51F18A00EEBB58 /* Headers */,
572EF2361B51F18A00EEBB58 /* Resources */, 572EF2361B51F18A00EEBB58 /* Resources */,
); );
buildRules = ( buildRules = (
@ -511,6 +517,7 @@
572EF2121B51F12F00EEBB58 /* Debug */ = { 572EF2121B51F12F00EEBB58 /* Debug */ = {
isa = XCBuildConfiguration; isa = XCBuildConfiguration;
buildSettings = { buildSettings = {
BITCODE_GENERATION_MODE = bitcode;
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_BOOL_CONVERSION = YES;
@ -530,11 +537,37 @@
CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
CODE_SIGN_IDENTITY = "Mac Developer"; CODE_SIGN_IDENTITY = "Mac Developer";
ENABLE_BITCODE = YES;
"ENABLE_BITCODE[sdk=macosx*]" = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES; ENABLE_TESTABILITY = YES;
FRAMEWORK_SEARCH_PATHS = ( "FRAMEWORK_SEARCH_PATHS[sdk=appletvos*]" = (
"$(inherited)",
"$(PROJECT_DIR)/Carthage/Build/tvOS",
);
"FRAMEWORK_SEARCH_PATHS[sdk=appletvsimulator*]" = (
"$(inherited)",
"$(PROJECT_DIR)/Carthage/Build/tvOS",
);
"FRAMEWORK_SEARCH_PATHS[sdk=iphoneos*]" = (
"$(inherited)",
"$(PROJECT_DIR)/Carthage/Build/iOS",
);
"FRAMEWORK_SEARCH_PATHS[sdk=iphonesimulator*]" = (
"$(inherited)",
"$(PROJECT_DIR)/Carthage/Build/iOS",
);
"FRAMEWORK_SEARCH_PATHS[sdk=macosx*]" = (
"$(inherited)",
"$(PROJECT_DIR)/Carthage/Build/Mac",
);
"FRAMEWORK_SEARCH_PATHS[sdk=watchos*]" = (
"$(PROJECT_DIR)/Carthage/Build/watchOS",
"$(inherited)",
);
"FRAMEWORK_SEARCH_PATHS[sdk=watchsimulator*]" = (
"$(PROJECT_DIR)/Carthage/Build/watchOS",
"$(inherited)", "$(inherited)",
"$(PROJECT_DIR)/Carthage/Build/",
); );
GCC_NO_COMMON_BLOCKS = YES; GCC_NO_COMMON_BLOCKS = YES;
GCC_OPTIMIZATION_LEVEL = 0; GCC_OPTIMIZATION_LEVEL = 0;
@ -548,7 +581,7 @@
MACOSX_DEPLOYMENT_TARGET = 10.14; MACOSX_DEPLOYMENT_TARGET = 10.14;
ONLY_ACTIVE_ARCH = YES; ONLY_ACTIVE_ARCH = YES;
PRODUCT_NAME = SocketIO; PRODUCT_NAME = SocketIO;
SUPPORTED_PLATFORMS = "macosx appletvsimulator appletvos iphonesimulator iphoneos watchos watchsimulator xrsimulator xros"; SUPPORTED_PLATFORMS = "macosx appletvsimulator appletvos iphonesimulator iphoneos watchos watchsimulator";
SWIFT_OPTIMIZATION_LEVEL = "-Onone"; SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 5.0; SWIFT_VERSION = 5.0;
TVOS_DEPLOYMENT_TARGET = 10.0; TVOS_DEPLOYMENT_TARGET = 10.0;
@ -560,6 +593,7 @@
572EF2131B51F12F00EEBB58 /* Release */ = { 572EF2131B51F12F00EEBB58 /* Release */ = {
isa = XCBuildConfiguration; isa = XCBuildConfiguration;
buildSettings = { buildSettings = {
BITCODE_GENERATION_MODE = bitcode;
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_BOOL_CONVERSION = YES;
@ -579,10 +613,36 @@
CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
CODE_SIGN_IDENTITY = "Mac Developer"; CODE_SIGN_IDENTITY = "Mac Developer";
ENABLE_BITCODE = YES;
"ENABLE_BITCODE[sdk=macosx*]" = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_STRICT_OBJC_MSGSEND = YES;
FRAMEWORK_SEARCH_PATHS = ( "FRAMEWORK_SEARCH_PATHS[sdk=appletvos*]" = (
"$(inherited)",
"$(PROJECT_DIR)/Carthage/Build/tvOS",
);
"FRAMEWORK_SEARCH_PATHS[sdk=appletvsimulator*]" = (
"$(inherited)",
"$(PROJECT_DIR)/Carthage/Build/tvOS",
);
"FRAMEWORK_SEARCH_PATHS[sdk=iphoneos*]" = (
"$(inherited)",
"$(PROJECT_DIR)/Carthage/Build/iOS",
);
"FRAMEWORK_SEARCH_PATHS[sdk=iphonesimulator*]" = (
"$(inherited)",
"$(PROJECT_DIR)/Carthage/Build/iOS",
);
"FRAMEWORK_SEARCH_PATHS[sdk=macosx*]" = (
"$(inherited)",
"$(PROJECT_DIR)/Carthage/Build/Mac",
);
"FRAMEWORK_SEARCH_PATHS[sdk=watchos*]" = (
"$(PROJECT_DIR)/Carthage/Build/watchOS",
"$(inherited)",
);
"FRAMEWORK_SEARCH_PATHS[sdk=watchsimulator*]" = (
"$(PROJECT_DIR)/Carthage/Build/watchOS",
"$(inherited)", "$(inherited)",
"$(PROJECT_DIR)/Carthage/Build/",
); );
GCC_NO_COMMON_BLOCKS = YES; GCC_NO_COMMON_BLOCKS = YES;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES; GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
@ -594,9 +654,8 @@
IPHONEOS_DEPLOYMENT_TARGET = 10.0; IPHONEOS_DEPLOYMENT_TARGET = 10.0;
MACOSX_DEPLOYMENT_TARGET = 10.14; MACOSX_DEPLOYMENT_TARGET = 10.14;
PRODUCT_NAME = SocketIO; PRODUCT_NAME = SocketIO;
SUPPORTED_PLATFORMS = "macosx appletvsimulator appletvos iphonesimulator iphoneos watchos watchsimulator xrsimulator xros"; SUPPORTED_PLATFORMS = "macosx appletvsimulator appletvos iphonesimulator iphoneos watchos watchsimulator";
SWIFT_COMPILATION_MODE = wholemodule; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
SWIFT_OPTIMIZATION_LEVEL = "-O";
SWIFT_VERSION = 5.0; SWIFT_VERSION = 5.0;
TVOS_DEPLOYMENT_TARGET = 10.0; TVOS_DEPLOYMENT_TARGET = 10.0;
VALID_ARCHS = "i386 x86_64 armv7 armv7s arm64 armv7k"; VALID_ARCHS = "i386 x86_64 armv7 armv7s arm64 armv7k";
@ -607,7 +666,6 @@
572EF24C1B51F18A00EEBB58 /* Debug */ = { 572EF24C1B51F18A00EEBB58 /* Debug */ = {
isa = XCBuildConfiguration; isa = XCBuildConfiguration;
buildSettings = { buildSettings = {
ALLOW_TARGET_PLATFORM_SPECIALIZATION = YES;
ALWAYS_SEARCH_USER_PATHS = NO; ALWAYS_SEARCH_USER_PATHS = NO;
APPLICATION_EXTENSION_API_ONLY = YES; APPLICATION_EXTENSION_API_ONLY = YES;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
@ -632,6 +690,8 @@
DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1; DYLIB_CURRENT_VERSION = 1;
DYLIB_INSTALL_NAME_BASE = "@rpath"; DYLIB_INSTALL_NAME_BASE = "@rpath";
ENABLE_BITCODE = YES;
"ENABLE_BITCODE[sdk=macosx*]" = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES; ENABLE_TESTABILITY = YES;
FRAMEWORK_SEARCH_PATHS = "$(inherited)"; FRAMEWORK_SEARCH_PATHS = "$(inherited)";
@ -652,17 +712,8 @@
GCC_WARN_UNUSED_VARIABLE = YES; GCC_WARN_UNUSED_VARIABLE = YES;
INFOPLIST_FILE = SocketIO/Info.plist; INFOPLIST_FILE = SocketIO/Info.plist;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
IPHONEOS_DEPLOYMENT_TARGET = 12.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
LD_RUNPATH_SEARCH_PATHS = ( "LD_RUNPATH_SEARCH_PATHS[sdk=macosx*]" = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks";
"$(inherited)",
"@executable_path/Frameworks",
"@loader_path/Frameworks",
);
"LD_RUNPATH_SEARCH_PATHS[sdk=macosx*]" = (
"$(inherited)",
"@executable_path/../Frameworks",
"@loader_path/../Frameworks",
);
LIBRARY_SEARCH_PATHS = "$(inherited)"; LIBRARY_SEARCH_PATHS = "$(inherited)";
MACOSX_DEPLOYMENT_TARGET = 10.10; MACOSX_DEPLOYMENT_TARGET = 10.10;
MTL_ENABLE_DEBUG_INFO = YES; MTL_ENABLE_DEBUG_INFO = YES;
@ -671,15 +722,12 @@
SDKROOT = macosx; SDKROOT = macosx;
SKIP_INSTALL = YES; SKIP_INSTALL = YES;
SUPPORTED_PLATFORMS = "$(inherited)"; SUPPORTED_PLATFORMS = "$(inherited)";
SUPPORTS_MACCATALYST = YES;
SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO;
SUPPORTS_XR_DESIGNED_FOR_IPHONE_IPAD = NO;
SWIFT_INCLUDE_PATHS = ""; SWIFT_INCLUDE_PATHS = "";
SWIFT_OPTIMIZATION_LEVEL = "-Onone"; SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_SWIFT3_OBJC_INFERENCE = Default; SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 5.0; SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2,3,4,7"; TARGETED_DEVICE_FAMILY = "1,2,3,4";
TVOS_DEPLOYMENT_TARGET = 12.0; TVOS_DEPLOYMENT_TARGET = 10.0;
VALID_ARCHS = "$(inherited)"; VALID_ARCHS = "$(inherited)";
VERSIONING_SYSTEM = "apple-generic"; VERSIONING_SYSTEM = "apple-generic";
VERSION_INFO_PREFIX = ""; VERSION_INFO_PREFIX = "";
@ -689,7 +737,6 @@
572EF24D1B51F18A00EEBB58 /* Release */ = { 572EF24D1B51F18A00EEBB58 /* Release */ = {
isa = XCBuildConfiguration; isa = XCBuildConfiguration;
buildSettings = { buildSettings = {
ALLOW_TARGET_PLATFORM_SPECIALIZATION = YES;
ALWAYS_SEARCH_USER_PATHS = NO; ALWAYS_SEARCH_USER_PATHS = NO;
APPLICATION_EXTENSION_API_ONLY = YES; APPLICATION_EXTENSION_API_ONLY = YES;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
@ -714,6 +761,8 @@
DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1; DYLIB_CURRENT_VERSION = 1;
DYLIB_INSTALL_NAME_BASE = "@rpath"; DYLIB_INSTALL_NAME_BASE = "@rpath";
ENABLE_BITCODE = YES;
"ENABLE_BITCODE[sdk=macosx*]" = NO;
ENABLE_NS_ASSERTIONS = NO; ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES; ENABLE_TESTABILITY = YES;
@ -729,17 +778,8 @@
GCC_WARN_UNUSED_VARIABLE = YES; GCC_WARN_UNUSED_VARIABLE = YES;
INFOPLIST_FILE = SocketIO/Info.plist; INFOPLIST_FILE = SocketIO/Info.plist;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
IPHONEOS_DEPLOYMENT_TARGET = 12.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
LD_RUNPATH_SEARCH_PATHS = ( "LD_RUNPATH_SEARCH_PATHS[sdk=macosx*]" = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks";
"$(inherited)",
"@executable_path/Frameworks",
"@loader_path/Frameworks",
);
"LD_RUNPATH_SEARCH_PATHS[sdk=macosx*]" = (
"$(inherited)",
"@executable_path/../Frameworks",
"@loader_path/../Frameworks",
);
LIBRARY_SEARCH_PATHS = "$(inherited)"; LIBRARY_SEARCH_PATHS = "$(inherited)";
MACOSX_DEPLOYMENT_TARGET = 10.10; MACOSX_DEPLOYMENT_TARGET = 10.10;
MTL_ENABLE_DEBUG_INFO = NO; MTL_ENABLE_DEBUG_INFO = NO;
@ -747,14 +787,11 @@
SDKROOT = macosx; SDKROOT = macosx;
SKIP_INSTALL = YES; SKIP_INSTALL = YES;
SUPPORTED_PLATFORMS = "$(inherited)"; SUPPORTED_PLATFORMS = "$(inherited)";
SUPPORTS_MACCATALYST = YES;
SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO;
SUPPORTS_XR_DESIGNED_FOR_IPHONE_IPAD = NO;
SWIFT_INCLUDE_PATHS = ""; SWIFT_INCLUDE_PATHS = "";
SWIFT_SWIFT3_OBJC_INFERENCE = Default; SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 5.0; SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2,3,4,7"; TARGETED_DEVICE_FAMILY = "1,2,3,4";
TVOS_DEPLOYMENT_TARGET = 12.0; TVOS_DEPLOYMENT_TARGET = 10.0;
VALID_ARCHS = "$(inherited)"; VALID_ARCHS = "$(inherited)";
VERSIONING_SYSTEM = "apple-generic"; VERSIONING_SYSTEM = "apple-generic";
VERSION_INFO_PREFIX = ""; VERSION_INFO_PREFIX = "";
@ -782,6 +819,7 @@
COMBINE_HIDPI_IMAGES = YES; COMBINE_HIDPI_IMAGES = YES;
COPY_PHASE_STRIP = NO; COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = dwarf; DEBUG_INFORMATION_FORMAT = dwarf;
ENABLE_BITCODE = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_STRICT_OBJC_MSGSEND = YES;
FRAMEWORK_SEARCH_PATHS = ( FRAMEWORK_SEARCH_PATHS = (
"$(DEVELOPER_FRAMEWORKS_DIR)", "$(DEVELOPER_FRAMEWORKS_DIR)",
@ -824,17 +862,10 @@
GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES; GCC_WARN_UNUSED_VARIABLE = YES;
INFOPLIST_FILE = SocketIO/Info.plist; INFOPLIST_FILE = SocketIO/Info.plist;
LD_RUNPATH_SEARCH_PATHS = ( LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
"$(inherited)", "LD_RUNPATH_SEARCH_PATHS[sdk=macosx*]" = "@executable_path/../Frameworks @loader_path/../Frameworks";
"@executable_path/Frameworks",
"@loader_path/Frameworks",
);
"LD_RUNPATH_SEARCH_PATHS[sdk=macosx*]" = (
"@executable_path/../Frameworks",
"@loader_path/../Frameworks",
);
LIBRARY_SEARCH_PATHS = "$(inherited)"; LIBRARY_SEARCH_PATHS = "$(inherited)";
MACOSX_DEPLOYMENT_TARGET = 10.13; MACOSX_DEPLOYMENT_TARGET = 10.10;
MTL_ENABLE_DEBUG_INFO = YES; MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES; ONLY_ACTIVE_ARCH = YES;
PRODUCT_BUNDLE_IDENTIFIER = "io.socket.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_BUNDLE_IDENTIFIER = "io.socket.$(PRODUCT_NAME:rfc1034identifier)";
@ -844,7 +875,7 @@
SWIFT_OPTIMIZATION_LEVEL = "-Onone"; SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_SWIFT3_OBJC_INFERENCE = Default; SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 5.0; SWIFT_VERSION = 5.0;
TVOS_DEPLOYMENT_TARGET = 12.0; TVOS_DEPLOYMENT_TARGET = 10.0;
VALID_ARCHS = "$(inherited)"; VALID_ARCHS = "$(inherited)";
}; };
name = Debug; name = Debug;
@ -870,6 +901,7 @@
COMBINE_HIDPI_IMAGES = YES; COMBINE_HIDPI_IMAGES = YES;
COPY_PHASE_STRIP = NO; COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_BITCODE = NO;
ENABLE_NS_ASSERTIONS = NO; ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_STRICT_OBJC_MSGSEND = YES;
FRAMEWORK_SEARCH_PATHS = ( FRAMEWORK_SEARCH_PATHS = (
@ -906,17 +938,10 @@
GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES; GCC_WARN_UNUSED_VARIABLE = YES;
INFOPLIST_FILE = SocketIO/Info.plist; INFOPLIST_FILE = SocketIO/Info.plist;
LD_RUNPATH_SEARCH_PATHS = ( LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
"$(inherited)", "LD_RUNPATH_SEARCH_PATHS[sdk=macosx*]" = "@executable_path/../Frameworks @loader_path/../Frameworks";
"@executable_path/Frameworks",
"@loader_path/Frameworks",
);
"LD_RUNPATH_SEARCH_PATHS[sdk=macosx*]" = (
"@executable_path/../Frameworks",
"@loader_path/../Frameworks",
);
LIBRARY_SEARCH_PATHS = "$(inherited)"; LIBRARY_SEARCH_PATHS = "$(inherited)";
MACOSX_DEPLOYMENT_TARGET = 10.13; MACOSX_DEPLOYMENT_TARGET = 10.10;
MTL_ENABLE_DEBUG_INFO = NO; MTL_ENABLE_DEBUG_INFO = NO;
PRODUCT_BUNDLE_IDENTIFIER = "io.socket.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_BUNDLE_IDENTIFIER = "io.socket.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
@ -924,7 +949,7 @@
SUPPORTED_PLATFORMS = "$(inherited)"; SUPPORTED_PLATFORMS = "$(inherited)";
SWIFT_SWIFT3_OBJC_INFERENCE = Default; SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 5.0; SWIFT_VERSION = 5.0;
TVOS_DEPLOYMENT_TARGET = 12.0; TVOS_DEPLOYMENT_TARGET = 10.0;
VALID_ARCHS = "$(inherited)"; VALID_ARCHS = "$(inherited)";
}; };
name = Release; name = Release;

View File

@ -28,7 +28,7 @@ import Foundation
/// A class that represents a waiting ack call. /// A class that represents a waiting ack call.
/// ///
/// **NOTE**: You should not store this beyond the life of the event handler. /// **NOTE**: You should not store this beyond the life of the event handler.
public final class SocketAckEmitter: NSObject { public final class SocketAckEmitter : NSObject {
private unowned let socket: SocketIOClient private unowned let socket: SocketIOClient
private let ackNum: Int private let ackNum: Int
@ -101,7 +101,7 @@ public final class SocketAckEmitter: NSObject {
/// ... /// ...
/// } /// }
/// ``` /// ```
public final class OnAckCallback: NSObject { public final class OnAckCallback : NSObject {
private let ackNumber: Int private let ackNumber: Int
private let binary: Bool private let binary: Bool
private let items: [Any] private let items: [Any]

View File

@ -150,7 +150,6 @@ open class SocketIOClient: NSObject, SocketIOClientSpec {
manager.handleQueue.asyncAfter(deadline: DispatchTime.now() + timeoutAfter) {[weak self] in manager.handleQueue.asyncAfter(deadline: DispatchTime.now() + timeoutAfter) {[weak self] in
guard let this = self, this.status == .connecting || this.status == .notConnected else { return } guard let this = self, this.status == .connecting || this.status == .notConnected else { return }
DefaultSocketLogger.Logger.log("Timeout: Socket not connected, so setting to disconnected", type: this.logType)
this.status = .disconnected this.status = .disconnected
this.leaveNamespace() this.leaveNamespace()
@ -213,19 +212,6 @@ open class SocketIOClient: NSObject, SocketIOClientSpec {
/// - parameter items: The items to send with this event. May be left out. /// - parameter items: The items to send with this event. May be left out.
/// - parameter completion: Callback called on transport write completion. /// - parameter completion: Callback called on transport write completion.
open func emit(_ event: String, _ items: SocketData..., completion: (() -> ())? = nil) { open func emit(_ event: String, _ items: SocketData..., completion: (() -> ())? = nil) {
emit(event, with: items, completion: completion)
}
/// Send an event to the server, with optional data items and optional write completion handler.
///
/// If an error occurs trying to transform `items` into their socket representation, a `SocketClientEvent.error`
/// will be emitted. The structure of the error data is `[eventName, items, theError]`
///
/// - parameter event: The event to send.
/// - parameter items: The items to send with this event. May be left out.
/// - parameter completion: Callback called on transport write completion.
open func emit(_ event: String, with items: [SocketData], completion: (() -> ())?) {
do { do {
emit([event] + (try items.map({ try $0.socketRepresentation() })), completion: completion) emit([event] + (try items.map({ try $0.socketRepresentation() })), completion: completion)
} catch { } catch {
@ -256,30 +242,6 @@ open class SocketIOClient: NSObject, SocketIOClientSpec {
/// - parameter items: The items to send with this event. May be left out. /// - parameter items: The items to send with this event. May be left out.
/// - returns: An `OnAckCallback`. You must call the `timingOut(after:)` method before the event will be sent. /// - returns: An `OnAckCallback`. You must call the `timingOut(after:)` method before the event will be sent.
open func emitWithAck(_ event: String, _ items: SocketData...) -> OnAckCallback { open func emitWithAck(_ event: String, _ items: SocketData...) -> OnAckCallback {
emitWithAck(event, with: items)
}
/// Sends a message to the server, requesting an ack.
///
/// **NOTE**: It is up to the server send an ack back, just calling this method does not mean the server will ack.
/// Check that your server's api will ack the event being sent.
///
/// If an error occurs trying to transform `items` into their socket representation, a `SocketClientEvent.error`
/// will be emitted. The structure of the error data is `[eventName, items, theError]`
///
/// Example:
///
/// ```swift
/// socket.emitWithAck("myEvent", 1).timingOut(after: 1) {data in
/// ...
/// }
/// ```
///
/// - parameter event: The event to send.
/// - parameter items: The items to send with this event. May be left out.
/// - returns: An `OnAckCallback`. You must call the `timingOut(after:)` method before the event will be sent.
open func emitWithAck(_ event: String, with items: [SocketData]) -> OnAckCallback {
do { do {
return createOnAck([event] + (try items.map({ try $0.socketRepresentation() }))) return createOnAck([event] + (try items.map({ try $0.socketRepresentation() })))
} catch { } catch {

View File

@ -108,9 +108,6 @@ public enum SocketIOClientOption : ClientOption {
/// Sets an NSURLSessionDelegate for the underlying engine. Useful if you need to handle self-signed certs. /// Sets an NSURLSessionDelegate for the underlying engine. Useful if you need to handle self-signed certs.
case sessionDelegate(URLSessionDelegate) case sessionDelegate(URLSessionDelegate)
/// If passed `false`, the WebSocket stream will be configured with the useCustomEngine `false`.
case useCustomEngine(Bool)
/// The version of socket.io being used. This should match the server version. Default is 3. /// The version of socket.io being used. This should match the server version. Default is 3.
case version(SocketIOVersion) case version(SocketIOVersion)
@ -163,8 +160,6 @@ public enum SocketIOClientOption : ClientOption {
description = "sessionDelegate" description = "sessionDelegate"
case .enableSOCKSProxy: case .enableSOCKSProxy:
description = "enableSOCKSProxy" description = "enableSOCKSProxy"
case .useCustomEngine:
description = "customEngine"
case .version: case .version:
description = "version" description = "version"
} }
@ -218,8 +213,6 @@ public enum SocketIOClientOption : ClientOption {
value = delegate value = delegate
case let .enableSOCKSProxy(enable): case let .enableSOCKSProxy(enable):
value = enable value = enable
case let .useCustomEngine(enable):
value = enable
case let.version(versionNum): case let.version(versionNum):
value = versionNum value = versionNum
} }

View File

@ -108,16 +108,6 @@ public protocol SocketIOClientSpec : AnyObject {
/// - parameter completion: Callback called on transport write completion. /// - parameter completion: Callback called on transport write completion.
func emit(_ event: String, _ items: SocketData..., completion: (() -> ())?) func emit(_ event: String, _ items: SocketData..., completion: (() -> ())?)
/// Send an event to the server, with optional data items and optional write completion handler.
///
/// If an error occurs trying to transform `items` into their socket representation, a `SocketClientEvent.error`
/// will be emitted. The structure of the error data is `[eventName, items, theError]`
///
/// - parameter event: The event to send.
/// - parameter items: The items to send with this event. May be left out.
/// - parameter completion: Callback called on transport write completion.
func emit(_ event: String, with items: [SocketData], completion: (() -> ())?)
/// Call when you wish to tell the server that you've received the event for `ack`. /// Call when you wish to tell the server that you've received the event for `ack`.
/// ///
/// - parameter ack: The ack number. /// - parameter ack: The ack number.
@ -145,27 +135,6 @@ public protocol SocketIOClientSpec : AnyObject {
/// - returns: An `OnAckCallback`. You must call the `timingOut(after:)` method before the event will be sent. /// - returns: An `OnAckCallback`. You must call the `timingOut(after:)` method before the event will be sent.
func emitWithAck(_ event: String, _ items: SocketData...) -> OnAckCallback func emitWithAck(_ event: String, _ items: SocketData...) -> OnAckCallback
/// Sends a message to the server, requesting an ack.
///
/// **NOTE**: It is up to the server send an ack back, just calling this method does not mean the server will ack.
/// Check that your server's api will ack the event being sent.
///
/// If an error occurs trying to transform `items` into their socket representation, a `SocketClientEvent.error`
/// will be emitted. The structure of the error data is `[eventName, items, theError]`
///
/// Example:
///
/// ```swift
/// socket.emitWithAck("myEvent", 1).timingOut(after: 1) {data in
/// ...
/// }
/// ```
///
/// - parameter event: The event to send.
/// - parameter items: The items to send with this event. May be left out.
/// - returns: An `OnAckCallback`. You must call the `timingOut(after:)` method before the event will be sent.
func emitWithAck(_ event: String, with items: [SocketData]) -> OnAckCallback
/// Called when socket.io has acked one of our emits. Causes the corresponding ack callback to be called. /// Called when socket.io has acked one of our emits. Causes the corresponding ack callback to be called.
/// ///
/// - parameter ack: The number for this ack. /// - parameter ack: The number for this ack.

View File

@ -28,10 +28,8 @@ import Starscream
/// The class that handles the engine.io protocol and transports. /// The class that handles the engine.io protocol and transports.
/// See `SocketEnginePollable` and `SocketEngineWebsocket` for transport specific methods. /// See `SocketEnginePollable` and `SocketEngineWebsocket` for transport specific methods.
open class SocketEngine: NSObject, WebSocketDelegate, URLSessionDelegate, open class SocketEngine:
SocketEnginePollable, SocketEngineWebsocket, ConfigSettable { NSObject, WebSocketDelegate, URLSessionDelegate, SocketEnginePollable, SocketEngineWebsocket, ConfigSettable {
// MARK: Properties // MARK: Properties
private static let logType = "SocketEngine" private static let logType = "SocketEngine"
@ -113,9 +111,6 @@ open class SocketEngine: NSObject, WebSocketDelegate, URLSessionDelegate,
/// The url for WebSockets. /// The url for WebSockets.
public private(set) var urlWebSocket = URL(string: "http://localhost/")! public private(set) var urlWebSocket = URL(string: "http://localhost/")!
/// When `false`, the WebSocket `stream` will be configured with the useCustomEngine `false`.
public private(set) var useCustomEngine = true
/// The version of engine.io being used. Default is three. /// The version of engine.io being used. Default is three.
public private(set) var version: SocketIOVersion = .three public private(set) var version: SocketIOVersion = .three
@ -312,7 +307,7 @@ open class SocketEngine: NSObject, WebSocketDelegate, URLSessionDelegate,
includingCookies: session?.configuration.httpCookieStorage?.cookies(for: urlPollingWithSid) includingCookies: session?.configuration.httpCookieStorage?.cookies(for: urlPollingWithSid)
) )
ws = WebSocket(request: req, certPinner: certPinner, compressionHandler: compress ? WSCompression() : nil, useCustomEngine: useCustomEngine) ws = WebSocket(request: req, certPinner: certPinner, compressionHandler: compress ? WSCompression() : nil)
ws?.callbackQueue = engineQueue ws?.callbackQueue = engineQueue
ws?.delegate = self ws?.delegate = self
@ -629,8 +624,6 @@ open class SocketEngine: NSObject, WebSocketDelegate, URLSessionDelegate,
self.compress = true self.compress = true
case .enableSOCKSProxy: case .enableSOCKSProxy:
self.enableSOCKSProxy = true self.enableSOCKSProxy = true
case let .useCustomEngine(enable):
self.useCustomEngine = enable
case let .version(num): case let .version(num):
version = num version = num
default: default:
@ -749,22 +742,16 @@ extension SocketEngine {
/// - Parameters: /// - Parameters:
/// - event: WS Event /// - event: WS Event
/// - _: /// - _:
public func didReceive(event: Starscream.WebSocketEvent, client: Starscream.WebSocketClient) { public func didReceive(event: WebSocketEvent, client _: WebSocket) {
switch event { switch event {
case let .connected(headers): case let .connected(headers):
wsConnected = true wsConnected = true
self.client?.engineDidWebsocketUpgrade(headers: headers) client?.engineDidWebsocketUpgrade(headers: headers)
websocketDidConnect() websocketDidConnect()
case .cancelled: case .cancelled:
wsConnected = false wsConnected = false
websocketDidDisconnect(error: EngineError.canceled) websocketDidDisconnect(error: EngineError.canceled)
case .disconnected(_, _): case let .disconnected(reason, code):
wsConnected = false
websocketDidDisconnect(error: nil)
case .viabilityChanged(false):
wsConnected = false
websocketDidDisconnect(error: nil)
case .peerClosed:
wsConnected = false wsConnected = false
websocketDidDisconnect(error: nil) websocketDidDisconnect(error: nil)
case let .text(msg): case let .text(msg):

View File

@ -27,7 +27,7 @@ import Foundation
import Starscream import Starscream
/// Specifies a SocketEngine. /// Specifies a SocketEngine.
public protocol SocketEngineSpec: AnyObject { public protocol SocketEngineSpec: class {
// MARK: Properties // MARK: Properties
/// The client for this engine. /// The client for this engine.

View File

@ -132,7 +132,7 @@ open class SocketManager: NSObject, SocketManagerSpec, SocketParsable, SocketDat
private(set) var reconnectAttempts = -1 private(set) var reconnectAttempts = -1
private var _config: SocketIOClientConfiguration private var _config: SocketIOClientConfiguration
internal var currentReconnectAttempt = 0 private var currentReconnectAttempt = 0
private var reconnecting = false private var reconnecting = false
// MARK: Initializers // MARK: Initializers
@ -186,8 +186,9 @@ open class SocketManager: NSObject, SocketManagerSpec, SocketParsable, SocketDat
/// ///
/// Override if you wish to attach a custom `SocketEngineSpec`. /// Override if you wish to attach a custom `SocketEngineSpec`.
open func connect() { open func connect() {
if status == .connected || (status == .connecting && currentReconnectAttempt == 0) { guard !status.active else {
DefaultSocketLogger.Logger.log("Tried connecting an already active socket", type: SocketManager.logType) DefaultSocketLogger.Logger.log("Tried connecting an already active socket", type: SocketManager.logType)
return return
} }

View File

@ -45,7 +45,7 @@ import Foundation
/// To disconnect a socket and remove it from the manager, either call `SocketIOClient.disconnect()` on the socket, /// To disconnect a socket and remove it from the manager, either call `SocketIOClient.disconnect()` on the socket,
/// or call one of the `disconnectSocket` methods on this class. /// or call one of the `disconnectSocket` methods on this class.
/// ///
public protocol SocketManagerSpec : SocketEngineClient { public protocol SocketManagerSpec : AnyObject, SocketEngineClient {
// MARK: Properties // MARK: Properties
/// Returns the socket associated with the default namespace ("/"). /// Returns the socket associated with the default namespace ("/").

View File

@ -87,9 +87,7 @@ extension Dictionary where Key == String, Value == Any {
return compress ? .compress : nil return compress ? .compress : nil
case let ("enableSOCKSProxy", enable as Bool): case let ("enableSOCKSProxy", enable as Bool):
return .enableSOCKSProxy(enable) return .enableSOCKSProxy(enable)
case let ("version", version as Int): default:
return .version(SocketIOVersion(rawValue: version) ?? .three)
case _:
return nil return nil
} }
} }

View File

@ -28,6 +28,7 @@ class SocketAckManagerTest : XCTestCase {
func testManagerTimeoutAck() { func testManagerTimeoutAck() {
let callbackExpection = expectation(description: "Manager should timeout ack with noAck status") let callbackExpection = expectation(description: "Manager should timeout ack with noAck status")
let itemsArray = ["Hi", "ho"]
func callback(_ items: [Any]) { func callback(_ items: [Any]) {
XCTAssertEqual(items.count, 1, "Timed out ack should have one value") XCTAssertEqual(items.count, 1, "Timed out ack should have one value")

View File

@ -60,44 +60,6 @@ class SocketMangerTest : XCTestCase {
waitForExpectations(timeout: 0.3) waitForExpectations(timeout: 0.3)
} }
func testManagerDoesNotCallConnectWhenConnectingWithLessThanOneReconnect() {
setUpSockets()
let expect = expectation(description: "The manager should not call connect on the engine")
expect.isInverted = true
let engine = TestEngine(client: manager, url: manager.socketURL, options: nil)
engine.onConnect = {
expect.fulfill()
}
manager.setTestStatus(.connecting)
manager.setCurrentReconnect(currentReconnect: 0)
manager.engine = engine
manager.connect()
waitForExpectations(timeout: 0.3)
}
func testManagerCallConnectWhenConnectingAndMoreThanOneReconnect() {
setUpSockets()
let expect = expectation(description: "The manager should call connect on the engine")
let engine = TestEngine(client: manager, url: manager.socketURL, options: nil)
engine.onConnect = {
expect.fulfill()
}
manager.setTestStatus(.connecting)
manager.setCurrentReconnect(currentReconnect: 1)
manager.engine = engine
manager.connect()
waitForExpectations(timeout: 0.8)
}
func testManagerCallsDisconnect() { func testManagerCallsDisconnect() {
setUpSockets() setUpSockets()
@ -192,10 +154,6 @@ public enum ManagerExpectation: String {
} }
public class TestManager: SocketManager { public class TestManager: SocketManager {
public func setCurrentReconnect(currentReconnect: Int) {
self.currentReconnectAttempt = currentReconnect
}
public override func disconnect() { public override func disconnect() {
setTestStatus(.disconnected) setTestStatus(.disconnected)
} }

View File

@ -487,7 +487,7 @@ class TestEngine: SocketEngineSpec {
private(set) var ws: WebSocket? = nil private(set) var ws: WebSocket? = nil
private(set) var version = SocketIOVersion.three private(set) var version = SocketIOVersion.three
internal var onConnect: (() -> ())? fileprivate var onConnect: (() -> ())?
required init(client: SocketEngineClient, url: URL, options: [String: Any]?) { required init(client: SocketEngineClient, url: URL, options: [String: Any]?) {
self.client = client self.client = client

View File

@ -6,30 +6,11 @@ This guide will help you navigate the changes that were introduced in v16.
## Client supports multiple socket.io versions ## Client supports multiple socket.io versions
The client now supports socket.io 3 servers. This is mostly a transparent change, however if your server The client now supports socket.io 3 servers. This is mostly a transparent change, however if your sever
is socket.io 2, you must send `.version(.two)` as an option to the manager. is socket.io 2, you must send `.version(.two)` as an option to the manager.
```swift ```swift
SocketManager(socketURL: URL(string:"http://localhost:8087/")!, config: [.version(.two)]) SocketManager(socketURL: URL(string:"http://localhost:8087/")!, config: [.version(.two)])
``` ```
## How to upgrade
- first, upgrade the Socket.IO server to v4 with the compatibility mode enabled (`allowEIO3: true`)
- then, upgrade the clients to v16
- finally, once all clients have upgraded, disable the compatibility mode
You can check the version of the connection on the server side with:
```js
io.on("connection", (socket) => {
// either 3 for the 3rd revision of the protocol (Socket.IO v2) or 4 for the 4th revision (Socket.IO v3/v4)
const version = socket.conn.protocol;
});
```
See also:
- [Compatibility table](https://nuclearace.github.io/Socket.IO-Client-Swift/Compatibility.html)
- Migrating from 2.x to 3.0: https://socket.io/docs/v4/migrating-from-2-x-to-3-0/
- Migrating from 3.x to 4.0: https://socket.io/docs/v4/migrating-from-3-x-to-4-0/

View File

@ -1,61 +0,0 @@
Here is the compatibility table with the Node.js server:
<table>
<tr>
<th rowspan="2">Swift Client version</th>
<th colspan="3">Socket.IO server version</th>
</tr>
<tr>
<td align="center">2.x</td>
<td align="center">3.x</td>
<td align="center">4.x</td>
</tr>
<tr>
<td align="center">v15.x</td>
<td align="center"><b>YES</b></td>
<td align="center"><b>YES</b><sup>1</sup></td>
<td align="center"><b>YES</b><sup>2</sup></td>
</tr>
<tr>
<td align="center">v16.x</td>
<td align="center"><b>YES</b><sup>3</sup></td>
<td align="center"><b>YES</b></td>
<td align="center"><b>YES</b></td>
</tr>
</table>
[1] Yes, with <code><a href="https://socket.io/docs/v4/server-initialization/#allowEIO3">allowEIO3: true</a></code> (server) and `.connectParams(["EIO": "3"])` (client):
*Server*
```js
const { createServer } = require("http");
const { Server } = require("socket.io");
const httpServer = createServer();
const io = new Server(httpServer, {
allowEIO3: true
});
httpServer.listen(8080);
```
*Client*
```swift
SocketManager(socketURL: URL(string:"http://localhost:8080/")!, config: [.connectParams(["EIO": "3"])])
```
[2] Yes, <code><a href="https://socket.io/docs/v4/server-initialization/#allowEIO3">allowEIO3: true</a></code> (server)
[3] Yes, with `.version(.two)` (client):
```swift
SocketManager(socketURL: URL(string:"http://localhost:8080/")!, config: [.version(.two)])
```
See also:
- Migrating from 2.x to 3.0: https://socket.io/docs/v4/migrating-from-2-x-to-3-0/
- Migrating from 3.x to 4.0: https://socket.io/docs/v4/migrating-from-3-x-to-4-0/
- Socket.IO protocol: https://github.com/socketio/socket.io-protocol