How to use the Channel function from bindings

Find comprehensive JavaScript bindings.Channel code examples handpicked from public code repositorys.

59
60
61
62
63
64
65
66
67
68
69


describe('channel', function() {
  describe('constructor', function() {
    it('should require a string for the first argument', function() {
      assert.doesNotThrow(function() {
        new grpc.Channel('hostname', insecureCreds);
      });
      assert.throws(function() {
        new grpc.Channel();
      }, TypeError);
fork icon1
star icon0
watch icon0

+ 31 other calls in file

630
631
632
633
634
635
636
637
638
639
  options = {};
}
options['grpc.primary_user_agent'] = 'grpc-node/' + version;
/* Private fields use $ as a prefix instead of _ because it is an invalid
 * prefix of a method name */
this.$channel = new grpc.Channel(address, credentials, options);
// Remove the optional DNS scheme, trailing port, and trailing backslash
address = address.replace(/^(dns:\/{3})?([^:\/]+)(:\d+)?\/?$/, '$2');
this.$server_address = address;
this.$auth_uri = 'https://' + this.$server_address + '/' + serviceName;
fork icon1
star icon0
watch icon0

+ 4 other calls in file

485
486
487
488
489
490
491
492
493
494
  } else {
    this.updateMetadata = function(metadata, callback) {
      callback(null, metadata);
    };
  }
  this.channel = new grpc.Channel(address, options);
}

_.each(methods, function(attrs, name) {
  var method_type;
fork icon0
star icon1
watch icon0

+ 2 other calls in file

64
65
66
67
68
69
70
71
72
73
before(function() {
  server = new grpc.Server();
  var port_num = server.addHttp2Port('0.0.0.0:0',
                                     grpc.ServerCredentials.createInsecure());
  server.start();
  channel = new grpc.Channel('localhost:' + port_num, insecureCreds);
});
after(function() {
  server.forceShutdown();
});
fork icon1
star icon0
watch icon0

+ 2 other calls in file

55
56
57
58
59
60
61
62
63
64
before(function() {
  server = new grpc.Server();
  var port = server.addHttp2Port('localhost:0',
                                 grpc.ServerCredentials.createInsecure());
  server.start();
  channel = new grpc.Channel('localhost:' + port, insecureCreds);
});
after(function() {
  server.forceShutdown();
});
fork icon1
star icon0
watch icon0

+ 3 other calls in file

103
104
105
106
107
108
109
110
111
112
      new grpc.Channel('hostname', insecureCreds, {'key' : new Date()});
    });
  });
  it('should succeed without the new keyword', function() {
    assert.doesNotThrow(function() {
      var channel = grpc.Channel('hostname', insecureCreds);
      assert(channel instanceof grpc.Channel);
    });
  });
});
fork icon0
star icon0
watch icon0

+ 67 other calls in file

Other functions in bindings

Sorted by popularity

function icon

bindings.createKey is the most popular function in bindings (8616 examples)