RN: Packager URL defaults to port 8081 if no port in bundleURL

Summary:The packager url for the persistent connection relied on a port
in the bundleURL, so we need to insert a sensible default. Otherwise,
issues occur: https://github.com/facebook/react-native/issues/6581

Reviewed By: bestander

Differential Revision: D3113034

fb-gh-sync-id: 4eac52631ad7abd343b75a4488bb591b5caf2145
fbshipit-source-id: 4eac52631ad7abd343b75a4488bb591b5caf2145
This commit is contained in:
Walter Luh 2016-03-30 12:37:16 -07:00 committed by Facebook Github Bot 1
parent 53355c692a
commit ac534387f8
1 changed files with 3 additions and 0 deletions

View File

@ -239,6 +239,9 @@ RCT_EXPORT_MODULE()
NSString *scheme = [_bridge.bundleURL scheme];
NSNumber *port = [_bridge.bundleURL port];
if (!port) {
port = @8081; // Packager default port
}
return [NSURL URLWithString:[NSString stringWithFormat:@"%@://%@:%@/message?role=shell", scheme, host, port]];
}