mirror of
https://github.com/ianramzy/decentralized-video-chat.git
synced 2024-11-13 13:49:19 +08:00
refresh only chat.js on disconnect
This commit is contained in:
parent
73edc600f2
commit
4106d01037
@ -123,6 +123,6 @@
|
||||
<script src="/socket.io/socket.io.js"></script>
|
||||
<script src="../js/snackbar.js"></script>
|
||||
<script src="../js/autolink.js"></script>
|
||||
<script src="../js/chat.js"></script>
|
||||
<script id="chatJS" src="../js/chat.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -137,33 +137,30 @@ var VideoChat = {
|
||||
switch (VideoChat.peerConnection.connectionState) {
|
||||
case "connected":
|
||||
logIt("connected");
|
||||
// alert("connected");
|
||||
function onConnect() {
|
||||
VideoChat.socket.disconnect();
|
||||
// VideoChat.peerConnection = null;
|
||||
}
|
||||
setTimeout(onConnect, 100);
|
||||
VideoChat.socket.disconnect();
|
||||
break;
|
||||
case "disconnected":
|
||||
case "failed":
|
||||
logIt("failed/disconnected");
|
||||
logIt(VideoChat);
|
||||
// VideoChat.socket = io();
|
||||
// VideoChat.socket.on("candidate", VideoChat.onCandidate);
|
||||
// VideoChat.socket.on("answer", VideoChat.onAnswer);
|
||||
|
||||
location.reload();
|
||||
|
||||
// startUp();
|
||||
// alert("failed/disconnected");
|
||||
logIt("Refreshing page...");
|
||||
function reloadScript(id) {
|
||||
var $el = $("#" + id);
|
||||
$("#" + id).replaceWith(
|
||||
'<script id="' +
|
||||
id +
|
||||
'" src="' +
|
||||
$el.prop("src") +
|
||||
'"></script>'
|
||||
);
|
||||
}
|
||||
reloadScript("chatJS");
|
||||
// location.reload();
|
||||
break;
|
||||
case "closed":
|
||||
logIt("closed");
|
||||
// alert("closed");
|
||||
break;
|
||||
}
|
||||
};
|
||||
|
||||
callback();
|
||||
};
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user