Debugger channel messages should be processed only on a background thread

Reviewed By: bnham

Differential Revision: D5470226

fbshipit-source-id: ccbc351e3f64f2baa8a3c74c5d0c67c44731bf32
This commit is contained in:
Paco Estevez Garcia 2017-07-24 06:40:02 -07:00 committed by Facebook Github Bot
parent a806e9035e
commit d94f3e4b98
1 changed files with 3 additions and 0 deletions

View File

@ -18,6 +18,7 @@ const int RECONNECT_DELAY_MS = 2000;
NSURL *_url; NSURL *_url;
NSMutableDictionary<NSString *, RCTInspectorLocalConnection *> *_inspectorConnections; NSMutableDictionary<NSString *, RCTInspectorLocalConnection *> *_inspectorConnections;
RCTSRWebSocket *_webSocket; RCTSRWebSocket *_webSocket;
dispatch_queue_t _jsQueue;
BOOL _closed; BOOL _closed;
BOOL _suppressConnectionErrors; BOOL _suppressConnectionErrors;
} }
@ -45,6 +46,7 @@ RCT_NOT_IMPLEMENTED(- (instancetype)init)
if (self = [super init]) { if (self = [super init]) {
_url = url; _url = url;
_inspectorConnections = [NSMutableDictionary new]; _inspectorConnections = [NSMutableDictionary new];
_jsQueue = dispatch_queue_create("com.facebook.react.WebSocketExecutor", DISPATCH_QUEUE_SERIAL);
} }
return self; return self;
} }
@ -215,6 +217,7 @@ RCT_NOT_IMPLEMENTED(- (instancetype)init)
// timeouts, but it appears the iOS RCTSRWebSocket API doesn't have the same // timeouts, but it appears the iOS RCTSRWebSocket API doesn't have the same
// implemented options. // implemented options.
_webSocket = [[RCTSRWebSocket alloc] initWithURL:_url]; _webSocket = [[RCTSRWebSocket alloc] initWithURL:_url];
[_webSocket setDelegateDispatchQueue:_jsQueue];
_webSocket.delegate = self; _webSocket.delegate = self;
[_webSocket open]; [_webSocket open];
} }