Permalink
Browse files

ios:websocket:exectuor : Grab port from Bundle URL

Summary:
Grabbing the port from Bundle URL allows concurrent Remote JS Debugging using the same machine with running multiple instances of packager on different ports.

This improves the developer experience when developing and debugging cross-platform components.
Closes #10007

Differential Revision: D4008630

Pulled By: javache

fbshipit-source-id: fcf8495e564fd9ac7baf26a87ed3904898132aa0
  • Loading branch information...
1 parent 1df5c25 commit 54f48de48aae3da6379076bab0b710c7b47838ef @omeid omeid committed with Facebook Github Bot Oct 12, 2016
Showing with 6 additions and 1 deletion.
  1. +6 −1 Libraries/WebSocket/RCTWebSocketExecutor.m
@@ -53,7 +53,12 @@ - (void)setUp
{
if (!_url) {
NSUserDefaults *standardDefaults = [NSUserDefaults standardUserDefaults];
- NSInteger port = [standardDefaults integerForKey:@"websocket-executor-port"] ?: 8081;
+
+ NSInteger port = [standardDefaults integerForKey:@"websocket-executor-port"];
+ if (!port) {
+ port = [[[_bridge bundleURL] port] integerValue] ?: 8081;
+ }
+
NSString *host = [[_bridge bundleURL] host];
if (!host) {
host = @"localhost";

0 comments on commit 54f48de

Please sign in to comment.