diff --git a/AVOS/AVOSCloudIM/Vendor/SocketRocket/AVIMWebSocket.m b/AVOS/AVOSCloudIM/Vendor/SocketRocket/AVIMWebSocket.m index 4ef304deb..b5dd46260 100755 --- a/AVOS/AVOSCloudIM/Vendor/SocketRocket/AVIMWebSocket.m +++ b/AVOS/AVOSCloudIM/Vendor/SocketRocket/AVIMWebSocket.m @@ -1543,7 +1543,9 @@ - (void)stream:(NSStream *)aStream handleEvent:(NSStreamEvent)eventCode; } assert(_readBuffer); - if (!_secure && self.readyState == AVIM_CONNECTING && aStream == _inputStream) { + // didConnect fires after certificate verification if we're using pinned certificates. + BOOL usingPinnedCerts = [[_urlRequest AVIM_SSLPinnedCertificates] count] > 0; + if ((!_secure || !usingPinnedCerts) && self.readyState == AVIM_CONNECTING && aStream == _inputStream) { [self didConnect]; } [self _pumpWriting]; diff --git a/AVOS/AVOSCloudIM/WebSocket/AVIMWebSocketWrapper.m b/AVOS/AVOSCloudIM/WebSocket/AVIMWebSocketWrapper.m index f1018fa40..d683affa2 100644 --- a/AVOS/AVOSCloudIM/WebSocket/AVIMWebSocketWrapper.m +++ b/AVOS/AVOSCloudIM/WebSocket/AVIMWebSocketWrapper.m @@ -497,11 +497,6 @@ - (void)internalOpenWebSocketConnection:(NSString *)server { _webSocket = [[AVIMWebSocket alloc] initWithURLRequest:request]; } - if (self.security) { - request.AVIM_SSLPinnedCertificates = [self pinnedCertificates]; - _webSocket.SSLPinningMode = AVIMSSLPinningModePublicKey; - } - _webSocket.delegate = self; [_webSocket open]; }