當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript grpc.credentials類代碼示例

本文整理匯總了TypeScript中grpc.credentials的典型用法代碼示例。如果您正苦於以下問題:TypeScript credentials類的具體用法?TypeScript credentials怎麽用?TypeScript credentials使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了credentials類的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: start

 /**
  * start launches the gRPC server and provides the service endpoints.
  */
 start(): void {
   if (!this.isBound) {
     let credentials = grpc.ServerCredentials.createInsecure();
     if (_.has(this.config, 'credentials.ssl')) {
       credentials = grpc.credentials.createSsl(
         this.config.credentials.ssl.certs);
     }
     this.server.bind(this.config.addr, credentials);
     this.isBound = true;
   }
   this.server.start();
 }
開發者ID:restorecommerce,項目名稱:chassis-srv,代碼行數:15,代碼來源:index.ts

示例2: main

function main() {

  let dispatch = new slack.Dispatch('slack:50051', grpc.credentials.createInsecure());

  chatEventEmitter.on('INCOMING_MESSAGE', () => {
    // console.log('SLACK SERVICE INCOMING_MESSAGE');
  });

  chatEventEmitter.on('NEW_CONVERSATION', (channelRequest) => {
    var name = channelRequest.channel_name.toString()
    let channelRequest2 = {
      channel_name: name
    };

    // console.log('SENDING: ', channelRequest2);

    dispatch.createChannel(channelRequest2, (err, slackChannel) => {
      // console.log('GRPC_ERR: ', err);
      // console.log('GRPC_RES: ', slackChannel);
    });
  });
}
開發者ID:sirbabelot,項目名稱:babelot-server,代碼行數:22,代碼來源:index.ts

示例3: Initialise

let ExportedMethods = {
  async Initialise() {
    // console.log('init is entered')
    if (initInProgress) {
      // console.log('init is already in progress, waiting until the other one completes')
      await checkPortSet()
      // console.log('init is complete, returning to normal process')
      return
    }
    initInProgress = true
    console.log('init is called')
    let feapiport = await ipc.callMain('GetFrontendAPIPort')
    feAPIConsumer = new proto.FrontendAPIClient(
      '127.0.0.1:' + feapiport,
      grpc.credentials.createInsecure()
    )
    console.log(feAPIConsumer)
    let clapiserverport = await ipc.callMain('GetClientAPIServerPort')
    await ExportedMethods.SetClientAPIServerPort(clapiserverport)
    ipc.callMain('SetFrontendClientConnInitialised', true)
    Initialised = true
    initInProgress = false
  },
  GetAllBoards(callback: any) {
    WaitUntilFrontendReady(async function() {
      console.log('get all boards is making a call')
      console.log('initstate: ', Initialised)
      if (!Initialised) {
        await ExportedMethods.Initialise()
      }
開發者ID:nehbit,項目名稱:aether-public,代碼行數:30,代碼來源:feapiconsumer.ts


注:本文中的grpc.credentials類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。