How to use the globalAgent function from https

Find comprehensive JavaScript https.globalAgent code examples handpicked from public code repositorys.

225
226
227
228
229
230
231
232
233
234
https.globalAgent.options.rejectUnauthorized = false
const socket = io(MC.websocketUrl, {
  withCredentials: true,
  secure: true,
  ...(process.env.SERVER_ENV === 'development') && { ca: Fs.readFileSync(`${MC.repoRoot}/localhost_cert.pem`, 'ascii') },
  agent: https.globalAgent
})
socket.on('disconnect', async () => {
  await AwaitServerReconnect()
  socket.connect()
fork icon0
star icon3
watch icon3

56
57
58
59
60
61
62
63
64
65
  );
}
const next = iter.next();

if (next.done) {
  https.globalAgent.destroy();
  server.close();
} else {
  // Save `value` for check the next time.
  const [key, val] = next.value;
fork icon0
star icon0
watch icon0

+ 5 other calls in file

7
8
9
10
11
12
13
14
15
16
try {
    const app = await createApp();
    const port = process.env.PORT || 3000;

    http.globalAgent.maxSockets = 20;
    https.globalAgent.maxSockets = 20;

    app.listen(port, () => {
        logger.info(`Listening on port ${port}`);
    });
fork icon0
star icon0
watch icon0

62
63
64
65
66
67
68
69
70
71
72
73
if (userDefinedCAStores.length > 0) {
    Log.info('Found user provided CA store settings, synchronously applying those now...');


    https.globalAgent.options.ca = [];
    _.forEach(userDefinedCAStores, store => {
        https.globalAgent.options.ca.push(Fs.readFileSync(store));
    });
}


Log.info('Modules loaded, starting overnight Blaze  Daemon...');
fork icon0
star icon0
watch icon0

+ 3 other calls in file