Changed the host for RCTWebSocketExecutor to the one retrieved from the bridge.
Reviewed By: javache Differential Revision: D3425043 fbshipit-source-id: 342d3dfede6a29197dedb68278ee088dcf009e16
This commit is contained in:
parent
a4f772f5f7
commit
9443bc5c3f
|
@ -13,6 +13,7 @@
|
|||
|
||||
#import "RCTWebSocketExecutor.h"
|
||||
|
||||
#import "RCTBridge.h"
|
||||
#import "RCTConvert.h"
|
||||
#import "RCTLog.h"
|
||||
#import "RCTUtils.h"
|
||||
|
@ -36,6 +37,8 @@ typedef void (^RCTWSMessageCallback)(NSError *error, NSDictionary<NSString *, id
|
|||
|
||||
RCT_EXPORT_MODULE()
|
||||
|
||||
@synthesize bridge = _bridge;
|
||||
|
||||
- (instancetype)initWithURL:(NSURL *)URL
|
||||
{
|
||||
RCTAssertParam(URL);
|
||||
|
@ -51,7 +54,11 @@ RCT_EXPORT_MODULE()
|
|||
if (!_url) {
|
||||
NSUserDefaults *standardDefaults = [NSUserDefaults standardUserDefaults];
|
||||
NSInteger port = [standardDefaults integerForKey:@"websocket-executor-port"] ?: 8081;
|
||||
NSString *URLString = [NSString stringWithFormat:@"http://localhost:%zd/debugger-proxy?role=client", port];
|
||||
NSString *host = [[_bridge bundleURL] host];
|
||||
if (!host) {
|
||||
host = @"localhost";
|
||||
}
|
||||
NSString *URLString = [NSString stringWithFormat:@"http://%@:%zd/debugger-proxy?role=client", host, port];
|
||||
_url = [RCTConvert NSURL:URLString];
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue