How to use the @bentley/imodeljs-common.ElectronRpcManager.initializeImpl function in @bentley/imodeljs-common

To help you get started, we’ve selected a few @bentley/imodeljs-common examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github imodeljs / imodeljs / test-apps / perf-test-app / src / backend / backend.ts View on Github external
async function init() {
  if (ElectronRpcConfiguration.isElectron) {
    ElectronRpcManager.initializeImpl({}, rpcInterfaces);
  } else {
    const rpcConfig = BentleyCloudRpcManager.initializeImpl({ info: { title: "perf-tests", version: "v1.0" } }, rpcInterfaces);

    // create a basic express web server
    const port = Number(process.env.CERTA_PORT || 3011) + 2000;
    const server = new IModelJsExpressServer(rpcConfig.protocol);
    await server.initialize(port);
    // tslint:disable-next-line:no-console
    console.log("Web backend for perf-tests listening on port " + port);
  }
}
github imodeljs / imodeljs / integration-tests / core / src / backend / backend.ts View on Github external
async function init() {
  if (ElectronRpcConfiguration.isElectron) {
    ElectronRpcManager.initializeImpl({}, rpcInterfaces);
  } else {
    const rpcConfig = BentleyCloudRpcManager.initializeImpl({ info: { title: "integration-test", version: "v1.0" } }, rpcInterfaces);

    // create a basic express web server
    const port = Number(process.env.CERTA_PORT || 3011) + 2000;
    const server = new IModelJsExpressServer(rpcConfig.protocol);
    await server.initialize(port);
    // tslint:disable-next-line:no-console
    console.log("Web backend for integration-tests listening on port " + port);
  }
}
github imodeljs / imodeljs / test-apps / display-test-app / src / backend / ElectronMain.ts View on Github external
});
  });

  await manager.initialize({
    width: 1280,
    height: 800,
    webPreferences: {
      nodeIntegration: true,
      experimentalFeatures: true, // Needed for CSS Grid support
    },
    autoHideMenuBar: true,
    show: !maximizeWindow,
  });

  // Initialize application gateway configuration for the backend
  ElectronRpcManager.initializeImpl({}, getRpcInterfaces());

  if (manager.mainWindow) {
    if (maximizeWindow) {
      manager.mainWindow.maximize(); // maximize before showing to avoid resize event on startup
      manager.mainWindow.show();
    }
    if (autoOpenDevTools)
      manager.mainWindow.webContents.toggleDevTools();
  }

  // tslint:disable-next-line:no-var-requires
  const configPathname = path.normalize(path.join(__dirname, "../webresources", "config.json"));
  const configuration = require(configPathname);
  if (configuration.useIModelBank) {
    electron.app.on("certificate-error", (event, _webContents, _url, _error, _certificate, callback) => {
      // (needed temporarily to use self-signed cert to communicate with iModelBank via https)
github imodeljs / imodeljs / test-apps / presentation-test-app / src / backend / electron / ElectronMain.ts View on Github external
export default async function initialize(rpcs: RpcInterfaceDefinition[]) {
  // tell ElectronRpcManager which RPC interfaces to handle
  // __PUBLISH_EXTRACT_START__ Presentation.Backend.RpcInterface
  ElectronRpcManager.initializeImpl({}, rpcs);
  // __PUBLISH_EXTRACT_END__

  const app = (process.env.NODE_ENV === "development") ? new WebpackDevServerElectronManager() : new IModelJsElectronManager();
  return app.initialize();
}
github imodeljs / imodeljs / test-apps / display-performance-test-app / src / backend / ElectronMain.ts View on Github external
(async () => { // tslint:disable-line:no-floating-promises
  const manager = new IModelJsElectronManager(path.join(__dirname, "..", "webresources"));

  await manager.initialize({
    width: 1280,
    height: 800,
    webPreferences: {
      nodeIntegration: true,
      experimentalFeatures: true, // Needed for CSS Grid support
    },
    autoHideMenuBar: true,
    show: !maximizeWindow,
  });

  // Initialize application gateway configuration for the backend
  ElectronRpcManager.initializeImpl({}, getRpcInterfaces());

  if (manager.mainWindow) {
    if (maximizeWindow) {
      manager.mainWindow.maximize(); // maximize before showing to avoid resize event on startup
      manager.mainWindow.show();
    }
    if (autoOpenDevTools)
      manager.mainWindow.webContents.toggleDevTools();
  }

  // tslint:disable-next-line:no-var-requires
  const configPathname = path.normalize(path.join(__dirname, "../webresources", "config.json"));
  const configuration = require(configPathname);
  if (configuration.useIModelBank) {
    electron.app.on("certificate-error", (event, _webContents, _url, _error, _certificate, callback) => {
      // (needed temporarily to use self-signed cert to communicate with iModelBank via https)
github imodeljs / imodeljs / test-apps / testbed / common / TestbedConfig.ts View on Github external
public static initializeRpcBackend() {
    if (TestbedConfig.useDirect) {
      // N/A -- only for testing code within frontend bundle
    } else if (TestbedConfig.useIPC) {
      ElectronRpcManager.initializeImpl({}, TestbedConfig.rpcInterfaces);
    } else {
      TestbedConfig.cloudRpc = BentleyCloudRpcManager.initializeImpl(TestbedConfig.cloudRpcParams, TestbedConfig.rpcInterfaces);
      TestbedConfig.initializeBentleyCloudCommon();
    }

    ElectronRpcManager.initializeImpl({}, [TestRpcInterface3]);

    // RPC transport testing
    RpcManager.registerImpl(RpcWebTransportTest, RpcTransportTestImpl);
    RpcManager.registerImpl(RpcElectronTransportTest, RpcTransportTestImpl);
    RpcManager.registerImpl(RpcMobileTransportTest, RpcTransportTestImpl);

    BentleyCloudRpcManager.initializeImpl(TestbedConfig.cloudRpcParams, [RpcWebTransportTest]);
    ElectronRpcManager.initializeImpl({}, [RpcElectronTransportTest]);
    MobileRpcManager.initializeImpl([RpcMobileTransportTest]);
  }
github imodeljs / imodeljs / test-apps / ui-test-app / src / backend / electron / ElectronMain.ts View on Github external
(async () => { // tslint:disable-line:no-floating-promises
    const manager = new IModelJsElectronManager(path.join(__dirname, "..", "..", "webresources"));

    await manager.initialize({
      width: 800,
      height: 650,
      autoHideMenuBar: true,
      show: true,
      webPreferences: {
        nodeIntegration: true,
        preload: path.join(__dirname, "preload.js"),
      },
    });

    // tell ElectronRpcManager which RPC interfaces to handle
    ElectronRpcManager.initializeImpl({}, rpcs);

    const mainWindow = manager.mainWindow!;
    assert(!!mainWindow);

    if (autoOpenDevTools)
      mainWindow.webContents.toggleDevTools();
  })();
}
github imodeljs / imodeljs / example-code / app / src / backend / RobotWorldRpcImpl.ts View on Github external
export function initializeRpcImplDesktop(interfaces: RpcInterfaceDefinition[]) {
  ElectronRpcManager.initializeImpl({}, interfaces);
}
// __PUBLISH_EXTRACT_END__