I am working with grpc-web, essentially trying to port a working server side vanilla grpc/node example to the browser. My existing node client example connects to the grpc service like so.
var services = require('./my_services_grpc_pb');
var grpc = require('grpc');
var secureClient = new services.MyServicesServiceClient(
(host + ":" + port),
grpc.credentials.createSsl(
fs.readFileSync(certFile)
)
);
That seems to do what I want. However, when I try to include the line
var grpc = require('grpc');
And then bundle my code with webpack, I get an error "cannot resolve child_process". I did a bit of googling and found that child_process does not work in the browser. I'm in a bit of a bind now, because the code examples that I saw on the web-grpc-tutorial do not seem show how to establish a secure connection. They look like this
var echoService = new EchoServiceClient('http://localhost:8080');
How would I go about passing certs to the call/establishing a secure channel?