mirror of https://github.com/jetkvm/kvm.git
fix: use wss when the page is served over https
This commit is contained in:
parent
a9a8df5d9c
commit
b9c4f4a24b
|
@ -232,10 +232,12 @@ export default function KvmIdRoute() {
|
||||||
const isSettingRemoteAnswerPending = useRef(false);
|
const isSettingRemoteAnswerPending = useRef(false);
|
||||||
const makingOffer = useRef(false);
|
const makingOffer = useRef(false);
|
||||||
|
|
||||||
|
const wsProtocol = window.location.protocol === "https:" ? "wss:" : "ws:";
|
||||||
|
|
||||||
console.log("isondevice", isOnDevice);
|
console.log("isondevice", isOnDevice);
|
||||||
const { sendMessage } = useWebSocket(
|
const { sendMessage } = useWebSocket(
|
||||||
isOnDevice
|
isOnDevice
|
||||||
? `ws://${window.location.host}/webrtc/signaling`
|
? `${wsProtocol}//${window.location.host}/webrtc/signaling`
|
||||||
: `${CLOUD_API.replace("http", "ws")}/webrtc/signaling?id=${params.id}`,
|
: `${CLOUD_API.replace("http", "ws")}/webrtc/signaling?id=${params.id}`,
|
||||||
{
|
{
|
||||||
heartbeat: true,
|
heartbeat: true,
|
||||||
|
|
Loading…
Reference in New Issue