From 68d002f4164753c1356f0bd3f0635ee114fe8183 Mon Sep 17 00:00:00 2001 From: Lawrence Forooghian Date: Wed, 28 Oct 2020 21:25:33 +0000 Subject: [PATCH] Update SocketRocket dependency to 0.5.2-ably-8 --- .../SoakTestWebSocket.swift | 4 +-- Ably.podspec | 2 +- Cartfile | 2 +- Cartfile.resolved | 2 +- Source/ARTWebSocket.h | 4 +-- Source/ARTWebSocketTransport+Private.h | 2 +- Source/ARTWebSocketTransport.m | 28 +++++++++---------- Spec/TestUtilities.swift | 2 +- 8 files changed, 23 insertions(+), 23 deletions(-) diff --git a/Ably-SoakTest-AppUITests/SoakTestWebSocket.swift b/Ably-SoakTest-AppUITests/SoakTestWebSocket.swift index 103826323..664a89982 100644 --- a/Ably-SoakTest-AppUITests/SoakTestWebSocket.swift +++ b/Ably-SoakTest-AppUITests/SoakTestWebSocket.swift @@ -10,7 +10,7 @@ import Ably.Private import SocketRocketAblyFork class SoakTestWebSocket: NSObject, ARTWebSocket { - var readyState: SRReadyState + var readyState: ARTSRReadyState var queue: DispatchQueue! var delegate: ARTWebSocketDelegate? @@ -60,7 +60,7 @@ class SoakTestWebSocket: NSObject, ARTWebSocket { } self.doIfStillOpen(afterSecondsBetween: 3.0 ... 300.0) { - let (code, clean) : (SRStatusCode, Bool) = [ + let (code, clean) : (ARTSRStatusCode, Bool) = [ (.codeAbnormal, false), (.codeNormal, true), (.codeGoingAway, true), diff --git a/Ably.podspec b/Ably.podspec index 17584f67b..8beb70a76 100644 --- a/Ably.podspec +++ b/Ably.podspec @@ -19,7 +19,7 @@ Pod::Spec.new do |s| s.source_files = 'Source/**/*.{h,m,swift}' s.private_header_files = 'Source/*+Private.h', 'Source/Private/*.h' s.module_map = 'Source/Ably.modulemap' - s.dependency 'SocketRocketAblyFork', '0.5.2-ably-7' + s.dependency 'SocketRocketAblyFork', '0.5.2-ably-8' s.dependency 'msgpack', '0.3.1' s.dependency 'ULID', '1.1.0' s.dependency 'AblyDeltaCodec', '1.2.0' diff --git a/Cartfile b/Cartfile index 8da54d323..07cc044f4 100644 --- a/Cartfile +++ b/Cartfile @@ -1,4 +1,4 @@ -github "ably-forks/SocketRocket" == 0.5.2-ably-7 +github "ably-forks/SocketRocket" == 0.5.2-ably-8 github "ably/delta-codec-cocoa" == 1.2.0 github "rvi/msgpack-objective-C" == 0.3.1 github "whitesmith/ulid" == 1.1.0 diff --git a/Cartfile.resolved b/Cartfile.resolved index 91c0a5a1b..5709108bb 100644 --- a/Cartfile.resolved +++ b/Cartfile.resolved @@ -1,7 +1,7 @@ github "Quick/Nimble" "v9.0.0" github "Quick/Quick" "v3.0.0" github "SwiftyJSON/SwiftyJSON" "4.3.0" -github "ably-forks/SocketRocket" "0.5.2-ably-7" +github "ably-forks/SocketRocket" "0.5.2-ably-8" github "ably/delta-codec-cocoa" "1.2.0" github "rvi/msgpack-objective-C" "0.3.1" github "whitesmith/Aspects" "1.4.2-ws1" diff --git a/Source/ARTWebSocket.h b/Source/ARTWebSocket.h index e20c2b7cc..79591a70b 100644 --- a/Source/ARTWebSocket.h +++ b/Source/ARTWebSocket.h @@ -15,12 +15,12 @@ NS_ASSUME_NONNULL_BEGIN @protocol ARTWebSocketDelegate; /** - This protocol has the subset of SRWebSocket we actually use. + This protocol has the subset of ARTSRWebSocket we actually use. */ @protocol ARTWebSocket @property (nonatomic, weak) id _Nullable delegate; -@property (atomic, assign, readonly) SRReadyState readyState; +@property (atomic, assign, readonly) ARTSRReadyState readyState; - (instancetype)initWithURLRequest:(NSURLRequest *)request; diff --git a/Source/ARTWebSocketTransport+Private.h b/Source/ARTWebSocketTransport+Private.h index 31f118d39..7d694dc57 100644 --- a/Source/ARTWebSocketTransport+Private.h +++ b/Source/ARTWebSocketTransport+Private.h @@ -8,7 +8,7 @@ #import #import -#import +#import #import #import #import diff --git a/Source/ARTWebSocketTransport.m b/Source/ARTWebSocketTransport.m index 5e6a5293c..e829a9d68 100644 --- a/Source/ARTWebSocketTransport.m +++ b/Source/ARTWebSocketTransport.m @@ -36,9 +36,9 @@ ARTWsTlsError = 1015 }; -NSString *WebSocketStateToStr(SRReadyState state); +NSString *WebSocketStateToStr(ARTSRReadyState state); -@interface SRWebSocket () +@interface ARTSRWebSocket () @end Class configuredWebsocketClass = nil; @@ -86,7 +86,7 @@ - (void)dealloc { } - (BOOL)send:(NSData *)data withSource:(id)decodedObject { - if (self.websocket.readyState == SR_OPEN) { + if (self.websocket.readyState == ARTSR_OPEN) { if ([decodedObject isKindOfClass:[ARTProtocolMessage class]]) { [_protocolMessagesLogger info:@"send %@", [decodedObject description]]; } @@ -203,7 +203,7 @@ - (NSURL *)setupWebSocket:(__GENERIC(NSArray, NSURLQueryItem *) *)params withOpt NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url]; - const Class websocketClass = configuredWebsocketClass ? configuredWebsocketClass : [SRWebSocket class]; + const Class websocketClass = configuredWebsocketClass ? configuredWebsocketClass : [ARTSRWebSocket class]; self.websocket = [[websocketClass alloc] initWithURLRequest:request]; [self.websocket setDelegateDispatchQueue:_workQueue]; self.websocket.delegate = self; @@ -254,7 +254,7 @@ - (NSString *)host { } - (ARTRealtimeTransportState)state { - if (self.websocket.readyState == SR_OPEN) { + if (self.websocket.readyState == ARTSR_OPEN) { return ARTRealtimeTransportStateOpened; } return _state; @@ -264,7 +264,7 @@ - (void)setState:(ARTRealtimeTransportState)state { _state = state; } -#pragma mark - SRWebSocketDelegate +#pragma mark - ARTSRWebSocketDelegate // All delegate methods from SocketRocket are called from rest's serial queue, // since we pass it as delegate queue on setupWebSocket. So we can safely @@ -331,8 +331,8 @@ - (ARTRealtimeTransportError *)classifyError:(NSError *)error { type = ARTRealtimeTransportErrorTypeHostUnreachable; } else if ([error.domain isEqualToString:@"NSPOSIXErrorDomain"] && (error.code == 57 || error.code == 50)) { type = ARTRealtimeTransportErrorTypeNoInternet; - } else if ([error.domain isEqualToString:SRWebSocketErrorDomain] && error.code == 2132) { - id status = error.userInfo[SRHTTPResponseErrorKey]; + } else if ([error.domain isEqualToString:ARTSRWebSocketErrorDomain] && error.code == 2132) { + id status = error.userInfo[ARTSRHTTPResponseErrorKey]; if (status) { return [[ARTRealtimeTransportError alloc] initWithError:error badResponseCode:[(NSNumber *)status integerValue] @@ -346,7 +346,7 @@ - (ARTRealtimeTransportError *)classifyError:(NSError *)error { - (void)webSocket:(id)webSocket didReceiveMessage:(id)message { [self.logger verbose:__FILE__ line:__LINE__ message:@"R:%p WS:%p websocket did receive message", _delegate, self]; - if (self.websocket.readyState == SR_CLOSED) { + if (self.websocket.readyState == ARTSR_CLOSED) { [self.logger debug:__FILE__ line:__LINE__ message:@"R:%p WS:%p websocket is closed, message has been ignored", _delegate, self]; return; } @@ -383,15 +383,15 @@ - (void)webSocketMessageProtocol:(ARTProtocolMessage *)message { @end -NSString *WebSocketStateToStr(SRReadyState state) { +NSString *WebSocketStateToStr(ARTSRReadyState state) { switch (state) { - case SR_CONNECTING: + case ARTSR_CONNECTING: return @"Connecting"; //0 - case SR_OPEN: + case ARTSR_OPEN: return @"Open"; //1 - case SR_CLOSING: + case ARTSR_CLOSING: return @"Closing"; //2 - case SR_CLOSED: + case ARTSR_CLOSED: return @"Closed"; //3 } } diff --git a/Spec/TestUtilities.swift b/Spec/TestUtilities.swift index 74e4e6baa..c2343349f 100644 --- a/Spec/TestUtilities.swift +++ b/Spec/TestUtilities.swift @@ -995,7 +995,7 @@ class TestProxyTransport: ARTWebSocketTransport { private func setupFakeNetworkResponse(_ networkResponse: FakeNetworkResponse) { var hook: AspectToken? - hook = SRWebSocket.testSuite_replaceClassMethod(#selector(SRWebSocket.open)) { + hook = ARTSRWebSocket.testSuite_replaceClassMethod(#selector(ARTSRWebSocket.open)) { if TestProxyTransport.fakeNetworkResponse == nil { return }