Skip to content
This repository was archived by the owner on Jun 13, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cartfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
github "BoltsFramework/Bolts-Swift" >= 1.5.0
github "ParsePlatform/Parse-SDK-iOS-OSX" >= 1.19.0
github "daltoniam/Starscream" == 3.1.1
github "daltoniam/Starscream" >= 4.0.4
4 changes: 2 additions & 2 deletions Cartfile.resolved
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
github "BoltsFramework/Bolts-ObjC" "1.9.1"
github "BoltsFramework/Bolts-Swift" "1.5.0"
github "ParsePlatform/Parse-SDK-iOS-OSX" "1.19.0"
github "daltoniam/Starscream" "3.1.1"
github "ParsePlatform/Parse-SDK-iOS-OSX" "1.19.1"
github "daltoniam/Starscream" "4.0.4"
github "facebook/facebook-objc-sdk" "v6.5.2"
2 changes: 1 addition & 1 deletion Carthage/Checkouts/Parse-SDK-iOS-OSX
2 changes: 1 addition & 1 deletion Carthage/Checkouts/Starscream
Submodule Starscream updated 46 files
+1 −1 .travis.yml
+38 −0 CHANGELOG.md
+64 −59 Gemfile.lock
+8 −5 Package.swift
+67 −197 README.md
+29 −0 Sources/Compression/Compression.swift
+87 −17 Sources/Compression/WSCompression.swift
+53 −0 Sources/DataBytes/Data+Extensions.swift
+22 −0 Sources/Engine/Engine.swift
+96 −0 Sources/Engine/NativeEngine.swift
+234 −0 Sources/Engine/WSEngine.swift
+123 −0 Sources/Framer/FoundationHTTPHandler.swift
+99 −0 Sources/Framer/FoundationHTTPServerHandler.swift
+107 −0 Sources/Framer/FrameCollector.swift
+365 −0 Sources/Framer/Framer.swift
+148 −0 Sources/Framer/HTTPHandler.swift
+143 −0 Sources/Framer/StringHTTPHandler.swift
+1 −1 Sources/Info.plist
+101 −0 Sources/Security/FoundationSecurity.swift
+45 −0 Sources/Security/Security.swift
+56 −0 Sources/Server/Server.swift
+196 −0 Sources/Server/WebSocketServer.swift
+0 −92 Sources/Starscream/SSLClientCertificate.swift
+0 −266 Sources/Starscream/SSLSecurity.swift
+82 −1,260 Sources/Starscream/WebSocket.swift
+218 −0 Sources/Transport/FoundationTransport.swift
+159 −0 Sources/Transport/TCPTransport.swift
+55 −0 Sources/Transport/Transport.swift
+1 −1 Starscream.podspec
+179 −20 Starscream.xcodeproj/project.pbxproj
+185 −0 Tests/FuzzingTests.swift
+130 −0 Tests/MockServer.swift
+65 −0 Tests/MockTransport.swift
+1 −1 build.sh
+41 −193 examples/AutobahnTest/Autobahn.xcodeproj/project.pbxproj
+1 −1 examples/AutobahnTest/Autobahn/AppDelegate.swift
+30 −0 examples/AutobahnTest/Autobahn/Images.xcassets/AppIcon.appiconset/Contents.json
+101 −83 examples/AutobahnTest/Autobahn/ViewController.swift
+0 −36 examples/AutobahnTest/AutobahnTests/AutobahnTests.swift
+0 −24 examples/AutobahnTest/AutobahnTests/Info.plist
+20 −72 examples/SimpleTest/SimpleTest.xcodeproj/project.pbxproj
+ ...eTest/SimpleTest.xcodeproj/project.xcworkspace/xcuserdata/dalton.xcuserdatad/UserInterfaceState.xcuserstate
+16 −2 examples/SimpleTest/SimpleTest/AppDelegate.swift
+5 −0 examples/SimpleTest/SimpleTest/Info.plist
+64 −19 examples/SimpleTest/SimpleTest/ViewController.swift
+1 −1 fastlane/README.md
4 changes: 2 additions & 2 deletions ParseLiveQuery.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Pod::Spec.new do |s|
s.swift_version = '5.0'
s.cocoapods_version = '>= 1.4'

s.ios.deployment_target = '8.0'
s.ios.deployment_target = '9.0'
s.tvos.deployment_target = '10.0'
s.osx.deployment_target = '10.12'

Expand All @@ -24,6 +24,6 @@ Pod::Spec.new do |s|

s.dependency 'Parse', '~> 1.19.0'
s.dependency 'Bolts-Swift', '~> 1.5.0'
s.dependency 'Starscream', '3.1.0'
s.dependency 'Starscream', '~> 4.0.4'

end
8 changes: 4 additions & 4 deletions Sources/ParseLiveQuery.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -891,7 +891,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
MACOSX_DEPLOYMENT_TARGET = 10.12;
ONLY_ACTIVE_ARCH = YES;
SWIFT_OBJC_BRIDGING_HEADER = "";
Expand Down Expand Up @@ -928,7 +928,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
MACOSX_DEPLOYMENT_TARGET = 10.12;
SWIFT_OBJC_BRIDGING_HEADER = "";
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
Expand Down Expand Up @@ -1003,7 +1003,7 @@
FRAMEWORK_VERSION = A;
INFOPLIST_FILE = ParseLiveQuery/Info.plist;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
LIBRARY_SEARCH_PATHS = "$(inherited)";
MARKETING_VERSION = 2.7.2;
Expand Down Expand Up @@ -1032,7 +1032,7 @@
FRAMEWORK_VERSION = A;
INFOPLIST_FILE = ParseLiveQuery/Info.plist;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
LIBRARY_SEARCH_PATHS = "$(inherited)";
MARKETING_VERSION = 2.7.2;
Expand Down
19 changes: 10 additions & 9 deletions Sources/ParseLiveQuery/Client.swift
Original file line number Diff line number Diff line change
Expand Up @@ -152,17 +152,18 @@ extension Client {
requestId: requestIdGenerator(),
handler: handler
)
subscriptions.append(subscriptionRecord)

self.subscriptions.append(subscriptionRecord)

if let socket = socket, socket.isConnected == true {
_ = sendOperationAsync(.subscribe(requestId: subscriptionRecord.requestId, query: query as! PFQuery<PFObject>,
if socket != nil {
_ = self.sendOperationAsync(.subscribe(requestId: subscriptionRecord.requestId, query: query as! PFQuery<PFObject>,
sessionToken: PFUser.current()?.sessionToken))
} else if !self.userDisconnected {
self.reconnect()
self.subscriptions.removeLast()
return self.subscribe(query, handler: handler)
} else {
if !userDisconnected {
reconnect()
} else {
NSLog("ParseLiveQuery: Warning: The client was explicitly disconnected! You must explicitly call .reconnect() in order to process your subscriptions.")
}
NSLog("ParseLiveQuery: Warning: The client was explicitly disconnected! You must explicitly call .reconnect() in order to process your subscriptions.")
}

return handler
Expand Down Expand Up @@ -233,7 +234,7 @@ extension Client {
guard socket == nil || !isConnecting else { return }
socket?.disconnect()
socket = {
let socket = WebSocket(url: host)
let socket = WebSocket(request: .init(url: host))
socket.delegate = self
socket.callbackQueue = queue
socket.connect()
Expand Down
51 changes: 26 additions & 25 deletions Sources/ParseLiveQuery/Internal/ClientPrivate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -115,32 +115,33 @@ func == (first: Client.RequestId, second: Client.RequestId) -> Bool {
// ---------------

extension Client: WebSocketDelegate {

public func websocketDidReceiveData(socket: WebSocketClient, data: Data) {
if shouldPrintWebSocketLog { NSLog("ParseLiveQuery: Received binary data but we don't handle it...") }
}

public func websocketDidReceiveMessage(socket: WebSocketClient, text: String) {
handleOperationAsync(text).continueWith { [weak self] task in
if let error = task.error, self?.shouldPrintWebSocketLog == true {
NSLog("ParseLiveQuery: Error processing message: \(error)")
public func didReceive(event: WebSocketEvent, client: WebSocket) {
switch event {

case .connected(_):
isConnecting = false
let sessionToken = PFUser.current()?.sessionToken ?? ""
_ = self.sendOperationAsync(.connect(applicationId: applicationId, sessionToken: sessionToken, clientKey: clientKey))
case .disconnected(let reason, let code):
isConnecting = false
if shouldPrintWebSocketLog { NSLog("ParseLiveQuery: WebSocket did disconnect with error: \(reason) code:\(code)") }

// TODO: Better retry logic, unless `disconnect()` was explicitly called
if !userDisconnected {
reconnect()
}
}
}

public func websocketDidConnect(socket: WebSocketClient) {
isConnecting = false
let sessionToken = PFUser.current()?.sessionToken ?? ""
_ = self.sendOperationAsync(.connect(applicationId: applicationId, sessionToken: sessionToken, clientKey: clientKey))
}

public func websocketDidDisconnect(socket: WebSocketClient, error: Error?) {
isConnecting = false
if shouldPrintWebSocketLog { NSLog("ParseLiveQuery: WebSocket did disconnect with error: \(String(describing: error))") }

// TODO: Better retry logic, unless `disconnect()` was explicitly called
if !userDisconnected {
reconnect()
case .text(let text):
handleOperationAsync(text).continueWith { [weak self] task in
if let error = task.error, self?.shouldPrintWebSocketLog == true {
NSLog("ParseLiveQuery: Error processing message: \(error)")
}
}
case .binary(_):
if shouldPrintWebSocketLog { NSLog("ParseLiveQuery: Received binary data but we don't handle it...") }
case .error(let error):
NSLog("ParseLiveQuery: Error processing message: \(String(describing: error))")
default:
break
}
}
}
Expand Down