Skip to content

Commit d94f3e4

Browse files
pakoitofacebook-github-bot
authored andcommitted
Debugger channel messages should be processed only on a background thread
Reviewed By: bnham Differential Revision: D5470226 fbshipit-source-id: ccbc351e3f64f2baa8a3c74c5d0c67c44731bf32
1 parent a806e90 commit d94f3e4

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

React/Inspector/RCTInspectorPackagerConnection.m

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ @interface RCTInspectorPackagerConnection () <RCTSRWebSocketDelegate> {
1818
NSURL *_url;
1919
NSMutableDictionary<NSString *, RCTInspectorLocalConnection *> *_inspectorConnections;
2020
RCTSRWebSocket *_webSocket;
21+
dispatch_queue_t _jsQueue;
2122
BOOL _closed;
2223
BOOL _suppressConnectionErrors;
2324
}
@@ -45,6 +46,7 @@ - (instancetype)initWithURL:(NSURL *)url
4546
if (self = [super init]) {
4647
_url = url;
4748
_inspectorConnections = [NSMutableDictionary new];
49+
_jsQueue = dispatch_queue_create("com.facebook.react.WebSocketExecutor", DISPATCH_QUEUE_SERIAL);
4850
}
4951
return self;
5052
}
@@ -215,6 +217,7 @@ - (void)connect
215217
// timeouts, but it appears the iOS RCTSRWebSocket API doesn't have the same
216218
// implemented options.
217219
_webSocket = [[RCTSRWebSocket alloc] initWithURL:_url];
220+
[_webSocket setDelegateDispatchQueue:_jsQueue];
218221
_webSocket.delegate = self;
219222
[_webSocket open];
220223
}

0 commit comments

Comments
 (0)