@fdm-monster/server
Version:
FDM Monster is a bulk OctoPrint manager to set up, configure and monitor 3D printers. Our aim is to provide extremely optimized websocket performance and reliability.
32 lines (31 loc) • 909 B
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
enumerable: true,
get: all[name]
});
}
_export(exports, {
defaultHttpProtocol: function() {
return defaultHttpProtocol;
},
httpToWsUrl: function() {
return httpToWsUrl;
}
});
const _zod = require("zod");
const _normalizeurl = require("./normalize-url");
const defaultHttpProtocol = "https";
function httpToWsUrl(url) {
const validUrl = _zod.z.string().parse(url);
const protocolNormalizedAddress = (0, _normalizeurl.normalizeUrl)(validUrl, {
defaultProtocol: defaultHttpProtocol
});
const wsUrl = new URL(protocolNormalizedAddress);
wsUrl.protocol = wsUrl.protocol === "https:" ? "wss:" : "ws:";
return wsUrl;
}
//# sourceMappingURL=url.utils.js.map