Compare commits

...
Author SHA1 Message Date
Erik Little e644abb839 enable bitcode 2023-02-01 18:35:31 -08:00
Erik Little a6825c8db1 disable bitcode 2023-02-01 18:23:57 -08:00
Erik Little b8f1fbabd6 try and fix carthage build 2023-02-01 18:20:18 -08:00
Erik Little 61a7f2e936 Merge pull request #1420 from ranker-dev/feature/custom-engine-option
Add option to allow the use of URLSessionWebSocketTask in WebSocket client.
2022-07-29 10:49:57 -04:00
George Navarro 45cc6b9728 Added a useCustomEngine option to control if WebSocket is initialized to use the custom engine or native URLSession web tasks. 2022-07-25 18:13:20 -07:00
Erik Little 173def3cea Remove travis 2022-07-12 14:55:55 -04:00
Erik Little 2b1cd74f6a Take weak reference to self in OnAckCallback 2022-07-12 14:34:38 -04:00
Erik Little e1c18a3ea8 Merge pull request #1410 from NachoSoto/headers-phase
Fixed build phases order in target
2022-04-18 15:03:48 -04:00
NachoSoto eb9de532f1 Fixed build phases order in target
See [Xcode 10's known issues](https://developer.apple.com/documentation/xcode-release-notes/build-system-release-notes-for-xcode-10) in the release notes:

> Targets with Copy Headers build phases ordered after Compile Sources build phases may fail to build and emit a diagnostic regarding build cycles. (39880168)
>*Workaround*: Arrange any Copy Headers build phases before Compile Sources build phases.

This has been an issue for nearly 4 years, and now with Xcode 13.3 it leads to `XCBBuildService` to crash consistently.
2022-04-18 20:16:09 +02:00
Erik Little b686b17e0a Merge pull request #1385 from NachoSoto/master
Added support for Mac Catalyst
2021-11-02 12:19:46 -07:00
NachoSoto c6d28246ea Updated project to use XCFramework
This enables support for macCatalyst
2021-11-02 11:05:38 -07:00
NachoSoto f4f071551f Added support for Mac Catalyst 2021-10-29 19:50:45 -07:00
Erik Little d031afdbc4 Merge pull request #1362 from darrachequesne/docs/compatibility
docs: add compatibility table
2021-07-10 06:51:24 -04:00
Damien Arrachequesne 61d0a41103 docs: add compatibility table 2021-07-10 11:32:24 +02:00
Erik Little 07f2d08981 Merge pull request #1359 from WyattMufson/swift-fixes
Fix swift warnings
2021-06-19 12:36:38 -04:00
Wyatt Mufson 9609774b3a Fix swift warnings 2021-06-17 11:38:43 -04:00
Erik Little 8d9a613835 Merge pull request #1335 from TysonAndre/patch-1
Fix typo in 15to16 upgrading notes
2021-03-02 14:44:39 -05:00
Tyson Andre 678fb81ed5 Fix typo in 15to16 upgrading notes 2021-03-02 14:42:02 -05:00
Erik Little af5ce97b75 Merge branch 'development'
* development:
  handle version in keyValueToSocketIOClientOption
  Updated methods signature
  Added client emit methods with array parameters
2021-02-16 09:38:49 -05:00
Erik Little 2c78e36ebd handle version in keyValueToSocketIOClientOption 2021-02-16 09:37:05 -05:00
Erik Little 162eb3d649 Merge pull request #1324 from OneSman7/development
Added client emit methods with array parameters
2021-02-10 08:57:19 -05:00
Erasov Ivan ef6b63c82f Updated methods signature 2021-02-09 00:13:42 +03:00
Erasov Ivan c015012783 Added client emit methods with array parameters 2021-02-05 19:14:54 +03:00
Erik Little 6b80f75ec8 Merge branch 'development'
* development:
  Update and gen docs
  prepare podspec for release
  Regenerate docs
  update docs, remove other prints
  remove print
  Support both v2 and v3
  Start working on migration guide
  update docs
  Add ability to send payload with connect
  more CocoaPods testing
  CocoaPods testing
  Fix tests
  Better timeouts
  Support socket.io 3 + starscream 4
  update examples for new operator
  Add some helpful operators
  fix swift syntax highlighting
  show how to test for ack timeouts
2021-02-01 09:30:30 -05:00
Erik Little bdcdddf465 Merge pull request #1309 from socketio/socket.io-3
Support socket.io 3 + starscream 4
2021-02-01 09:28:32 -05:00
Erik Little 9433f60557 Merge pull request #1165 from petergp/feature/allow-app-extension-api-only
Enabled allow app extension api only
2020-11-07 12:49:25 -05:00
Peter Gammelgaard Poulsen 0df634a586 Enabled allow app extension api only 2019-03-05 20:52:03 +01:00
15 changed files with 251 additions and 107 deletions

No files matched your search

+19
View File
@@ -0,0 +1,19 @@
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
-18
View File
@@ -1,18 +0,0 @@
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
+1 -1
View File
@@ -32,7 +32,7 @@ socket.connect()
```
## Features
- Supports socket.io 2.0+/3.0+.
- 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 Binary
- Supports Polling and WebSockets
- Supports TLS/SSL
+2 -2
View File
@@ -1,7 +1,7 @@
Pod::Spec.new do |s|
s.name = "Socket.IO-Client-Swift"
s.module_name = "SocketIO"
s.version = "16.0.0"
s.version = "16.0.1"
s.summary = "Socket.IO-client for iOS and OS X"
s.description = <<-DESC
Socket.IO-client for iOS and OS X.
@@ -18,7 +18,7 @@ Pod::Spec.new do |s|
s.requires_arc = true
s.source = {
:git => "https://github.com/socketio/socket.io-client-swift.git",
:tag => 'v16.0.0',
:tag => 'v16.0.1',
:submodules => true
}
@@ -3,7 +3,7 @@
archiveVersion = 1;
classes = {
};
objectVersion = 46;
objectVersion = 52;
objects = {
/* Begin PBXBuildFile section */
@@ -19,9 +19,9 @@
1C686BE71F869AFD007D8627 /* SocketParserTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1C686BD71F869AF1007D8627 /* SocketParserTest.swift */; };
1C686BE81F869AFD007D8627 /* SocketNamespacePacketTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1C686BD81F869AF1007D8627 /* SocketNamespacePacketTest.swift */; };
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 */; };
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 */; };
74DA217C1F09457B009C19EE /* libz.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 74DA21731F09440F009C19EE /* libz.tbd */; };
DD52B048C71D724ABBD18C71 /* SocketTypes.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD52BDC9E66AADA2CC5E8246 /* SocketTypes.swift */; };
@@ -75,18 +75,15 @@
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>"; };
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; };
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; };
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; };
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; };
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>"; };
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>"; };
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>"; };
@@ -120,8 +117,8 @@
buildActionMask = 2147483647;
files = (
74DA21741F09440F009C19EE /* libz.tbd in Frameworks */,
579C7D4C2731B487009F8A2F /* Starscream.xcframework in Frameworks */,
6CA08A981D615C0B0061FD2A /* Security.framework in Frameworks */,
74D0F5961F8053950037C4DC /* Starscream.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -231,11 +228,8 @@
isa = PBXGroup;
children = (
749FA1A11F811408002FBB30 /* Foundation.framework */,
749FA19F1F8112E7002FBB30 /* Starscream.framework.dSYM */,
579C7D4B2731B487009F8A2F /* Starscream.xcframework */,
74D0F58D1F804FED0037C4DC /* libz.tbd */,
9432E0091F77F87D006AF628 /* Starscream.framework */,
9432E00B1F77F883006AF628 /* Starscream.framework */,
9432E00D1F77F889006AF628 /* Starscream.framework */,
74DA217D1F0945E9009C19EE /* libcommonCrypto.tbd */,
74DA21731F09440F009C19EE /* libz.tbd */,
6CA08A9E1D615C340061FD2A /* tvOS */,
@@ -350,9 +344,9 @@
isa = PBXNativeTarget;
buildConfigurationList = 572EF24B1B51F18A00EEBB58 /* Build configuration list for PBXNativeTarget "SocketIO" */;
buildPhases = (
572EF2351B51F18A00EEBB58 /* Headers */,
572EF2331B51F18A00EEBB58 /* Sources */,
572EF2341B51F18A00EEBB58 /* Frameworks */,
572EF2351B51F18A00EEBB58 /* Headers */,
572EF2361B51F18A00EEBB58 /* Resources */,
);
buildRules = (
@@ -541,33 +535,9 @@
"ENABLE_BITCODE[sdk=macosx*]" = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
"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",
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/Carthage/Build/",
);
GCC_NO_COMMON_BLOCKS = YES;
GCC_OPTIMIZATION_LEVEL = 0;
@@ -616,33 +586,9 @@
ENABLE_BITCODE = YES;
"ENABLE_BITCODE[sdk=macosx*]" = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
"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",
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/Carthage/Build/",
);
GCC_NO_COMMON_BLOCKS = YES;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
@@ -655,7 +601,8 @@
MACOSX_DEPLOYMENT_TARGET = 10.14;
PRODUCT_NAME = SocketIO;
SUPPORTED_PLATFORMS = "macosx appletvsimulator appletvos iphonesimulator iphoneos watchos watchsimulator";
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
SWIFT_COMPILATION_MODE = wholemodule;
SWIFT_OPTIMIZATION_LEVEL = "-O";
SWIFT_VERSION = 5.0;
TVOS_DEPLOYMENT_TARGET = 10.0;
VALID_ARCHS = "i386 x86_64 armv7 armv7s arm64 armv7k";
@@ -667,6 +614,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
APPLICATION_EXTENSION_API_ONLY = YES;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
@@ -689,8 +637,8 @@
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
DYLIB_INSTALL_NAME_BASE = "@rpath";
ENABLE_BITCODE = YES;
"ENABLE_BITCODE[sdk=macosx*]" = NO;
ENABLE_BITCODE = NO;
"ENABLE_BITCODE[arch=*]" = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
FRAMEWORK_SEARCH_PATHS = "$(inherited)";
@@ -711,8 +659,16 @@
GCC_WARN_UNUSED_VARIABLE = YES;
INFOPLIST_FILE = SocketIO/Info.plist;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
"LD_RUNPATH_SEARCH_PATHS[sdk=macosx*]" = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks";
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
"@loader_path/Frameworks",
);
"LD_RUNPATH_SEARCH_PATHS[sdk=macosx*]" = (
"$(inherited)",
"@executable_path/../Frameworks",
"@loader_path/../Frameworks",
);
LIBRARY_SEARCH_PATHS = "$(inherited)";
MACOSX_DEPLOYMENT_TARGET = 10.10;
MTL_ENABLE_DEBUG_INFO = YES;
@@ -721,6 +677,7 @@
SDKROOT = macosx;
SKIP_INSTALL = YES;
SUPPORTED_PLATFORMS = "$(inherited)";
SUPPORTS_MACCATALYST = YES;
SWIFT_INCLUDE_PATHS = "";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
@@ -737,6 +694,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
APPLICATION_EXTENSION_API_ONLY = YES;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
@@ -760,7 +718,7 @@
DYLIB_CURRENT_VERSION = 1;
DYLIB_INSTALL_NAME_BASE = "@rpath";
ENABLE_BITCODE = YES;
"ENABLE_BITCODE[sdk=macosx*]" = NO;
"ENABLE_BITCODE[arch=*]" = YES;
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
@@ -776,8 +734,16 @@
GCC_WARN_UNUSED_VARIABLE = YES;
INFOPLIST_FILE = SocketIO/Info.plist;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
"LD_RUNPATH_SEARCH_PATHS[sdk=macosx*]" = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks";
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
"@loader_path/Frameworks",
);
"LD_RUNPATH_SEARCH_PATHS[sdk=macosx*]" = (
"$(inherited)",
"@executable_path/../Frameworks",
"@loader_path/../Frameworks",
);
LIBRARY_SEARCH_PATHS = "$(inherited)";
MACOSX_DEPLOYMENT_TARGET = 10.10;
MTL_ENABLE_DEBUG_INFO = NO;
@@ -785,6 +751,7 @@
SDKROOT = macosx;
SKIP_INSTALL = YES;
SUPPORTED_PLATFORMS = "$(inherited)";
SUPPORTS_MACCATALYST = YES;
SWIFT_INCLUDE_PATHS = "";
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 5.0;
@@ -860,8 +827,15 @@
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
INFOPLIST_FILE = SocketIO/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
"LD_RUNPATH_SEARCH_PATHS[sdk=macosx*]" = "@executable_path/../Frameworks @loader_path/../Frameworks";
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
"@loader_path/Frameworks",
);
"LD_RUNPATH_SEARCH_PATHS[sdk=macosx*]" = (
"@executable_path/../Frameworks",
"@loader_path/../Frameworks",
);
LIBRARY_SEARCH_PATHS = "$(inherited)";
MACOSX_DEPLOYMENT_TARGET = 10.10;
MTL_ENABLE_DEBUG_INFO = YES;
@@ -936,8 +910,15 @@
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
INFOPLIST_FILE = SocketIO/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
"LD_RUNPATH_SEARCH_PATHS[sdk=macosx*]" = "@executable_path/../Frameworks @loader_path/../Frameworks";
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
"@loader_path/Frameworks",
);
"LD_RUNPATH_SEARCH_PATHS[sdk=macosx*]" = (
"@executable_path/../Frameworks",
"@loader_path/../Frameworks",
);
LIBRARY_SEARCH_PATHS = "$(inherited)";
MACOSX_DEPLOYMENT_TARGET = 10.10;
MTL_ENABLE_DEBUG_INFO = NO;
+4 -4
View File
@@ -28,7 +28,7 @@ import Foundation
/// A class that represents a waiting ack call.
///
/// **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 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 binary: Bool
private let items: [Any]
@@ -136,8 +136,8 @@ public final class OnAckCallback : NSObject {
guard seconds != 0 else { return }
socket.manager?.handleQueue.asyncAfter(deadline: DispatchTime.now() + seconds) {[weak socket] in
guard let socket = socket else { return }
socket.manager?.handleQueue.asyncAfter(deadline: DispatchTime.now() + seconds) {[weak socket, weak self] in
guard let socket = socket, let `self` = self else { return }
socket.ackHandlers.timeoutAck(self.ackNumber)
}
@@ -212,6 +212,19 @@ open class SocketIOClient: NSObject, SocketIOClientSpec {
/// - 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, _ 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 {
emit([event] + (try items.map({ try $0.socketRepresentation() })), completion: completion)
} catch {
@@ -242,6 +255,30 @@ open class SocketIOClient: NSObject, SocketIOClientSpec {
/// - 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, _ 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 {
return createOnAck([event] + (try items.map({ try $0.socketRepresentation() })))
} catch {
@@ -108,6 +108,9 @@ public enum SocketIOClientOption : ClientOption {
/// Sets an NSURLSessionDelegate for the underlying engine. Useful if you need to handle self-signed certs.
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.
case version(SocketIOVersion)
@@ -160,6 +163,8 @@ public enum SocketIOClientOption : ClientOption {
description = "sessionDelegate"
case .enableSOCKSProxy:
description = "enableSOCKSProxy"
case .useCustomEngine:
description = "customEngine"
case .version:
description = "version"
}
@@ -213,6 +218,8 @@ public enum SocketIOClientOption : ClientOption {
value = delegate
case let .enableSOCKSProxy(enable):
value = enable
case let .useCustomEngine(enable):
value = enable
case let.version(versionNum):
value = versionNum
}
@@ -107,6 +107,16 @@ public protocol SocketIOClientSpec : AnyObject {
/// - 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, _ 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`.
///
@@ -134,6 +144,27 @@ public protocol SocketIOClientSpec : AnyObject {
/// - 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, _ 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.
///
+7 -2
View File
@@ -111,6 +111,9 @@ open class SocketEngine:
/// The url for WebSockets.
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.
public private(set) var version: SocketIOVersion = .three
@@ -307,7 +310,7 @@ open class SocketEngine:
includingCookies: session?.configuration.httpCookieStorage?.cookies(for: urlPollingWithSid)
)
ws = WebSocket(request: req, certPinner: certPinner, compressionHandler: compress ? WSCompression() : nil)
ws = WebSocket(request: req, certPinner: certPinner, compressionHandler: compress ? WSCompression() : nil, useCustomEngine: useCustomEngine)
ws?.callbackQueue = engineQueue
ws?.delegate = self
@@ -624,6 +627,8 @@ open class SocketEngine:
self.compress = true
case .enableSOCKSProxy:
self.enableSOCKSProxy = true
case let .useCustomEngine(enable):
self.useCustomEngine = enable
case let .version(num):
version = num
default:
@@ -751,7 +756,7 @@ extension SocketEngine {
case .cancelled:
wsConnected = false
websocketDidDisconnect(error: EngineError.canceled)
case let .disconnected(reason, code):
case .disconnected(_, _):
wsConnected = false
websocketDidDisconnect(error: nil)
case let .text(msg):
@@ -27,7 +27,7 @@ import Foundation
import Starscream
/// Specifies a SocketEngine.
public protocol SocketEngineSpec: class {
public protocol SocketEngineSpec: AnyObject {
// MARK: Properties
/// The client for this engine.
@@ -45,7 +45,7 @@ import Foundation
/// 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.
///
public protocol SocketManagerSpec : AnyObject, SocketEngineClient {
public protocol SocketManagerSpec : SocketEngineClient {
// MARK: Properties
/// Returns the socket associated with the default namespace ("/").
+3 -1
View File
@@ -87,7 +87,9 @@ extension Dictionary where Key == String, Value == Any {
return compress ? .compress : nil
case let ("enableSOCKSProxy", enable as Bool):
return .enableSOCKSProxy(enable)
default:
case let ("version", version as Int):
return .version(SocketIOVersion(rawValue: version) ?? .three)
case _:
return nil
}
}
+20 -1
View File
@@ -6,11 +6,30 @@ This guide will help you navigate the changes that were introduced in v16.
## Client supports multiple socket.io versions
The client now supports socket.io 3 servers. This is mostly a transparent change, however if your sever
The client now supports socket.io 3 servers. This is mostly a transparent change, however if your server
is socket.io 2, you must send `.version(.two)` as an option to the manager.
```swift
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/
+61
View File
@@ -0,0 +1,61 @@
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