How to use the @bentley/imodeljs-common.RpcManager.registerImpl 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 / 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 / testbed / common / TestbedConfig.ts View on Github external
TestbedConfig.initializeBentleyCloudCommon();
    }

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

    // RPC transport testing
    window.location.hash = TestbedConfig.mobilePort.toString();

    const webClient = BentleyCloudRpcManager.initializeClient(TestbedConfig.cloudRpcParams, [RpcWebTransportTest]);
    webClient.protocol.pathPrefix = TestbedConfig.localServerUrlPrefix;
    RpcOperation.forEach(RpcWebTransportTest, (operation) => operation.policy.token = (_request) => new IModelToken("test", "test", "test", "test", OpenMode.Readonly));

    ElectronRpcManager.initializeClient({}, [RpcElectronTransportTest]);

    RpcManager.initializeInterface(RpcDirectTransportTest);
    RpcManager.registerImpl(RpcDirectTransportTest, RpcTransportTestImpl);

    MobileRpcManager.initializeClient([RpcMobileTransportTest]);
  }
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 / example-code / app / src / backend / RobotWorldEngine.ts View on Github external
private static registerImpls() {
    // __PUBLISH_EXTRACT_START__ RpcInterface.registerImpls
    RpcManager.registerImpl(RobotWorldReadRpcInterface, RobotWorldReadRpcImpl);
    // __PUBLISH_EXTRACT_END__
  }
github imodeljs / imodeljs / presentation / backend / src / Presentation.ts View on Github external
public static initialize(props?: PresentationProps): void {
    try {
      RpcManager.registerImpl(PresentationRpcInterface, PresentationRpcImpl);
    } catch (_e) {
      // note: RpcManager.registerImpl throws when called more than once with the same
      // rpc interface. However, it doesn't provide any way to unregister a, interface so we end up
      // using the one registered first. At least we can avoid an exception...
    }
    this._initProps = props || {};
    this._shutdownListener = IModelHost.onBeforeShutdown.addListener(Presentation.terminate);
    this._requestTimeout = (props && props.requestTimeout !== undefined)
      ? props.requestTimeout
      : defaultRequestTimeout;
    this._clientsStorage = new TemporaryStorage({
      factory: this.createClientManager,
      cleanupHandler: this.disposeClientManager,
      // cleanup unused managers every minute
      cleanupInterval: 60 * 1000,
      // by default, manager is disposed after 1 hour of being unused
github imodeljs / imodeljs / test-apps / perf-test-app / src / backend / RpcImpl.ts View on Github external
public static register() {
    RpcManager.registerImpl(TestRpcInterface, TestRpcImpl);
  }
}
github imodeljs / imodeljs / integration-tests / rpc / src / common / TestRpcInterface.ts View on Github external
public static register() {
    RpcManager.registerImpl(RpcTransportTest, RpcTransportTestImpl);
  }
github imodeljs / imodeljs / integration-tests / core / src / backend / RpcImpl.ts View on Github external
public static register() {
    RpcManager.registerImpl(TestRpcInterface, TestRpcImpl);
  }
github imodeljs / imodeljs / test-apps / display-performance-test-app / src / backend / DisplayPerfRpcImpl.ts View on Github external
public async readExternalSavedViews(bimfileName: string): Promise {
    const esvFileName = this.createEsvFilename(bimfileName);
    if (!IModelJsFs.existsSync(esvFileName)) {
      return "";
    }
    const jsonStr = IModelJsFs.readFileSync(esvFileName).toString();
    if (undefined === jsonStr)
      return "";
    return jsonStr;
  }

}

/** Auto-register the impl when this file is included. */
RpcManager.registerImpl(DisplayPerfRpcInterface, DisplayPerfRpcImpl);
github imodeljs / imodeljs / core / backend / src / rpc-impl / WipRpcImpl.ts View on Github external
  public static register() { RpcManager.registerImpl(WipRpcInterface, WipRpcImpl); }
  public async placeholder(_tokenProps: IModelTokenProps): Promise { return "placeholder"; }