How to use the @bentley/imodeljs-common.BentleyCloudRpcManager.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 / integration-tests / rpc / src / backend / http.ts View on Github external
async function init() {
  const rpcConfig = BentleyCloudRpcManager.initializeImpl({ info: { title: "rpc-integration-test", version: "v1.0" } }, rpcInterfaces);

  // create a basic express web server
  const port = Number(process.env.CERTA_PORT || 3021) + 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 / 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-performance-test-app / src / backend / WebMain.ts View on Github external
if (arg.split(".").pop() === "json")
    DisplayPerfRpcInterface.jsonFilePath = arg;
  else if (arg === "chrome" || arg === "edge" || arg === "firefox")
    browser = arg;
});

if (serverConfig === undefined) {
  setupStandaloneConfiguration();

  serverConfig = { port: 3001, baseUrl: "https://localhost" };
} else {

}

// Set up the ability to serve the supported rpcInterfaces via web requests
const cloudConfig = BentleyCloudRpcManager.initializeImpl({ info: { title: "display-performance-test-app", version: "v1.0" } }, getRpcInterfaces());

const app = express();
app.use(bodyParser.text({ limit: "50mb" }));

// Enable CORS for all apis
app.all("/*", (_req, res, next) => {
  res.header("Access-Control-Allow-Origin", "*");
  res.header("Access-Control-Allow-Methods", "POST, GET");
  res.header("Access-Control-Allow-Headers", "Content-Type, Access-Control-Allow-Headers, Authorization, X-Requested-With, X-Correlation-Id, X-Session-Id, X-Application-Id, X-Application-Version, X-User-Id");
  next();
});

// --------------------------------------------
// Routes
// --------------------------------------------
app.use(express.static(path.resolve(__dirname, "public")));
github imodeljs / imodeljs / test-apps / ui-test-app / src / backend / web / BackendServer.ts View on Github external
export default async function initialize(rpcs: RpcInterfaceDefinition[]) {
  // tell BentleyCloudRpcManager which RPC interfaces to handle
  const rpcConfig = BentleyCloudRpcManager.initializeImpl({ info: { title: "ui-test-app", version: "v1.0" } }, rpcs);

  // create a basic express web server
  const port = Number(process.env.PORT || 3001);
  const server = new IModelJsExpressServer(rpcConfig.protocol);
  await server.initialize(port);
  console.log("Web backend for ui-test-app listening on port " + port);
}
github imodeljs / imodeljs / test-apps / testbed / common / TestbedConfig.ts View on Github external
// 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 / display-test-app / src / backend / WebMain.ts View on Github external
cert: fs.readFileSync(serverConfig.certFile),
    };
  } catch (_err) { }
}

if (serverConfig === undefined) {
  setupStandaloneConfiguration();
  serverConfig = { port: 3001, baseUrl: "https://localhost" };
} else {

}

Logger.logTrace("SVT", `config = ${JSON.stringify(serverConfig)}`);

// Set up the ability to serve the supported rpcInterfaces via web requests
const cloudConfig = BentleyCloudRpcManager.initializeImpl({ info: { title: "display-test-app", version: "v1.0" } }, getRpcInterfaces());

const app = express();
app.use(bodyParser.text());

// Enable CORS for all apis
app.all("/*", (_req, res, next) => {
  res.header("Access-Control-Allow-Origin", "*");
  res.header("Access-Control-Allow-Methods", "POST, GET");
  res.header("Access-Control-Allow-Headers", "Content-Type, Access-Control-Allow-Headers, Authorization, X-Requested-With, X-Correlation-Id, X-Session-Id, X-Application-Id, X-Application-Version, X-User-Id");
  next();
});

// --------------------------------------------
// Routes
// --------------------------------------------
app.get("/v3/swagger.json", (req, res) => cloudConfig.protocol.handleOpenApiDescriptionRequest(req, res));