🔄 Moved socket init code higher up into ComicDetail parent component

This commit is contained in:
2021-11-20 02:10:52 -08:00
parent 725c156e88
commit 5251803233
6 changed files with 111 additions and 41 deletions

View File

@@ -2,8 +2,15 @@ import { Socket } from "airdcpp-apisocket";
class AirDCPPSocket {
constructor(configuration) {
console.assert(configuration);
let socketProtocol = "";
if (configuration.protocol === "https") {
socketProtocol = "wss";
} else {
socketProtocol = "ws";
}
const options = {
url: `wss://${configuration.hostname}/api/v1/`,
url: `${socketProtocol}://${configuration.hostname}/api/v1/`,
autoReconnect: false,
reconnectInterval: 5,
logLevel: "verbose",
@@ -17,4 +24,5 @@ class AirDCPPSocket {
return AirDCPPSocketInstance;
}
}
export default AirDCPPSocket;