Q:

Is it posible to update ssl cert without server restarting?

I'd like to update ssl certificates on node.js http2 server without restarting (to avoid any downtime). Also I don't want to use any 3rd party modules for this work. Only pure nodejs.
Is it possible?
Right now when certificate about to expire, i just restarting the script. 
const https = require('http2');
const server = https.createSecureServer({
  ca: fs.readFileSync('chain.pem'),
  cert: fs.readFileSync('cert.pem', 'utf8'),//fullchain
  key: fs.readFileSync('privkey.pem', 'utf8'),
  allowHTTP1: true,
},

I expect to be able to watch if cert files were updated (using fs.watch() for example), and to update certificates in http2 server  on the fly...

A:

As mentioned by Jake, setSecureContext() do the magic.
Seems it can update certificate without breaking current connections.
Something like:
setTimeout(function () {server.setSecureContext({
  ca: fs.readFileSync('chain.pem'),
  cert: fs.readFileSync('cert.pem', 'utf8'),//fullchain
  key: fs.readFileSync('privkey.pem', 'utf8')
})},86400000)

