mirror of https://github.com/embarklabs/embark.git
Merge pull request #756 from embark-framework/feature/console-ipc-server-client
Console can be a client or server ipc
This commit is contained in:
commit
a1c2d7e77a
|
@ -79,7 +79,8 @@ class EmbarkController {
|
||||||
context: self.context,
|
context: self.context,
|
||||||
useDashboard: options.useDashboard,
|
useDashboard: options.useDashboard,
|
||||||
webServerConfig: webServerConfig,
|
webServerConfig: webServerConfig,
|
||||||
webpackConfigName: options.webpackConfigName
|
webpackConfigName: options.webpackConfigName,
|
||||||
|
ipcRole: 'server'
|
||||||
});
|
});
|
||||||
engine.init();
|
engine.init();
|
||||||
|
|
||||||
|
@ -247,7 +248,6 @@ class EmbarkController {
|
||||||
logFile: options.logFile,
|
logFile: options.logFile,
|
||||||
logLevel: options.logLevel,
|
logLevel: options.logLevel,
|
||||||
context: this.context,
|
context: this.context,
|
||||||
ipcRole: 'client',
|
|
||||||
webpackConfigName: options.webpackConfigName
|
webpackConfigName: options.webpackConfigName
|
||||||
});
|
});
|
||||||
engine.init();
|
engine.init();
|
||||||
|
|
|
@ -38,10 +38,23 @@ class Engine {
|
||||||
utils.interceptLogs(console, this.logger);
|
utils.interceptLogs(console, this.logger);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.ipc = new IPC({logger: this.logger, ipcRole: this.ipcRole});
|
if (this.ipcRole) {
|
||||||
if (this.ipc.isServer()) {
|
this.ipc = new IPC({logger: this.logger, ipcRole: this.ipcRole});
|
||||||
this.ipc.serve();
|
|
||||||
|
if(this.ipc.isServer()) {
|
||||||
|
this.ipc.serve();
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.ipc = new IPC({logger: this.logger, ipcRole: 'client'});
|
||||||
|
this.ipc.connect((err) => {
|
||||||
|
if(err) {
|
||||||
|
this.ipc = new IPC({logger: this.logger, ipcRole: 'server'});
|
||||||
|
this.ipc.serve();
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
registerModule(moduleName, options) {
|
registerModule(moduleName, options) {
|
||||||
|
|
Loading…
Reference in New Issue