I am working on a small application that is hosted via node.js
and uses socket.io
for quick communication. For now it was only in development so it was fine. However now i would like to switch from ws://
to wss://
but dont really know where to start. I tried to research online but there is not much on the topic.
index.js (server)
const path = require("path");
const express = require("express");
const app = express();
const cors = require("cors");
const config = require("./config");
const webRoute = require("./lib/routes/web");
const widgetsRoute = require("./lib/routes/widgets");
const errorsHandler = require("./lib/handlers/errors");
const corsHandler = require("./lib/handlers/cors");
app.use(cors(corsHandler));
app.use(express.static(path.join(__dirname, "/public")));
app.use("/", webRoute);
app.use("/widgets", widgetsRoute);
app.use(errorsHandler);
app.listen(4118, "0.0.0.0");
const io = require("socket.io").listen(
require("http")
.createServer()
.listen(4113, "0.0.0.0")
);
require("./lib/inits/socket")(io);
client:
this.socket = io("http://example.org:4113");
In the network tab i can see that socket.io is using ws://
in one of its calls.
How can i modify this so it uses wss
instead?