Permalink
Browse files

Move inspector proxy out of the packager

Reviewed By: pakoito

Differential Revision: D5369099

fbshipit-source-id: ff806d784b70804181c5c54837352f66e45d1b9e
  • Loading branch information...
Hypuk authored and facebook-github-bot committed Jul 10, 2017
1 parent f1cbb11 commit c00abe53c3e24218afa694b2b58440403a102fd2
@@ -3,6 +3,7 @@
#if RCT_DEV
#import <jschelpers/JSCWrapper.h>
#import <UIKit/UIKit.h>
#import "RCTDefines.h"
#import "RCTInspectorPackagerConnection.h"
@@ -16,10 +17,8 @@
host = @"localhost";
}
NSNumber *port = [bundleURL port];
if (!port) {
port = @8081; // Packager default port
}
// Inspector Proxy is run on a separate port (from packager).
NSNumber *port = @8082;
// this is consistent with the Android implementation, where http:// is the
// hardcoded implicit scheme for the debug server. Note, packagerURL
@@ -31,11 +30,9 @@
static NSURL *getInspectorDeviceUrl(NSURL *bundleURL)
{
// TODO: t19163919: figure out if there's a good way to get a friendly device
// name for the end user
return [NSURL URLWithString:[NSString stringWithFormat:@"http://%@/inspector/device?name=%@",
getDebugServerHost(bundleURL),
@""]];
[[UIDevice currentDevice] name]]];
}
@@ -13,7 +13,7 @@
public static final String DEVICE_LOCALHOST = "localhost";
private static final int DEBUG_SERVER_HOST_PORT = 8081;
private static final int INSPECTOR_PROXY_PORT = 8081;
private static final int INSPECTOR_PROXY_PORT = 8082;
private static boolean isRunningOnGenymotion() {
return Build.FINGERPRINT.contains("vbox");
@@ -13,7 +13,6 @@
'use strict';
require('../../setupBabel')();
const InspectorProxy = require('./util/inspectorProxy.js');
const ReactPackager = require('metro-bundler');
const Terminal = require('metro-bundler/src/lib/Terminal');
@@ -37,7 +36,6 @@ const openStackFrameInEditorMiddleware = require('./middleware/openStackFrameInE
const path = require('path');
const statusPageMiddleware = require('./middleware/statusPageMiddleware.js');
const systraceProfileMiddleware = require('./middleware/systraceProfileMiddleware.js');
const unless = require('./middleware/unless');
const webSocketProxy = require('./util/webSocketProxy.js');
import type {ConfigT} from '../util/Config';
@@ -69,7 +67,6 @@ function runServer(
const packagerServer = getPackagerServer(args, config);
startedCallback(packagerServer._reporter);
const inspectorProxy = new InspectorProxy();
const app = connect()
.use(loadRawBodyMiddleware)
.use(connect.compress())
@@ -83,9 +80,6 @@ function runServer(
.use(systraceProfileMiddleware)
.use(cpuProfilerMiddleware)
.use(indexPageMiddleware)
.use(
unless('/inspector', inspectorProxy.processRequest.bind(inspectorProxy)),
)
.use(packagerServer.processRequest.bind(packagerServer));
args.projectRoots.forEach(root => app.use(connect.static(root)));
@@ -115,7 +109,6 @@ function runServer(
wsProxy = webSocketProxy.attachToServer(serverInstance, '/debugger-proxy');
ms = messageSocket.attachToServer(serverInstance, '/message');
inspectorProxy.attachToServer(serverInstance, '/inspector');
readyCallback(packagerServer._reporter);
});
// Disable any kind of automatic timeout behavior for incoming
Oops, something went wrong.

0 comments on commit c00abe5

Please sign in to comment.