How to make socket.io support both http and https

this is my code

const Koa=require("koa");
const http=require("http");
const https=require("https");
const app=new Koa();
const fs = require("fs");
const enforceHttps = require("koa-sslify");

const config = require("./config");
const options = {
    key: fs.readFileSync("./XXXXXXXXX.key"),  //ssl
    cert: fs.readFileSync("./XXXXXXXXX.cer")  //ssl
};
const https_server = https.Server(options, app.callback());
const http_server = http.Server(app.callback());

//socket io
const io = require("socket.io")(https_server,{pingTimeout: 30000});

//http https
app.use(enforceHttps({redirectMethods:["GET"]}));
app.use(bodyparser());

io.attach(http_server);

http_server.listen(config.debug?3000:80);
https_server.listen(config.debug?3002:443);

I would like to ask you how to make the normal get and post and socket.io in node compatible with http and https requests!

Menu