From d94f3e4b98590f511e8283cfc9a0fd7aaed2e43e Mon Sep 17 00:00:00 2001 From: Paco Estevez Garcia Date: Mon, 24 Jul 2017 06:40:02 -0700 Subject: [PATCH] Debugger channel messages should be processed only on a background thread Reviewed By: bnham Differential Revision: D5470226 fbshipit-source-id: ccbc351e3f64f2baa8a3c74c5d0c67c44731bf32 --- React/Inspector/RCTInspectorPackagerConnection.m | 3 +++ 1 file changed, 3 insertions(+) diff --git a/React/Inspector/RCTInspectorPackagerConnection.m b/React/Inspector/RCTInspectorPackagerConnection.m index d3a26d188..3a2f8e587 100644 --- a/React/Inspector/RCTInspectorPackagerConnection.m +++ b/React/Inspector/RCTInspectorPackagerConnection.m @@ -18,6 +18,7 @@ const int RECONNECT_DELAY_MS = 2000; NSURL *_url; NSMutableDictionary *_inspectorConnections; RCTSRWebSocket *_webSocket; + dispatch_queue_t _jsQueue; BOOL _closed; BOOL _suppressConnectionErrors; } @@ -45,6 +46,7 @@ RCT_NOT_IMPLEMENTED(- (instancetype)init) if (self = [super init]) { _url = url; _inspectorConnections = [NSMutableDictionary new]; + _jsQueue = dispatch_queue_create("com.facebook.react.WebSocketExecutor", DISPATCH_QUEUE_SERIAL); } return self; } @@ -215,6 +217,7 @@ RCT_NOT_IMPLEMENTED(- (instancetype)init) // timeouts, but it appears the iOS RCTSRWebSocket API doesn't have the same // implemented options. _webSocket = [[RCTSRWebSocket alloc] initWithURL:_url]; + [_webSocket setDelegateDispatchQueue:_jsQueue]; _webSocket.delegate = self; [_webSocket open]; }