modifié: superTornado.py
modifié: video.html
This commit is contained in:
parent
fcd02cb32f
commit
e43d87c47d
@ -105,7 +105,7 @@ class WSocketHandler(BaseHandler,tornado.websocket.WebSocketHandler):
|
|||||||
|
|
||||||
|
|
||||||
def on_message(self,mesg):
|
def on_message(self,mesg):
|
||||||
pass
|
print "->Data receive"
|
||||||
|
|
||||||
def on_close(self):
|
def on_close(self):
|
||||||
print "->Websocket closed"
|
print "->Websocket closed"
|
||||||
|
17
video.html
17
video.html
@ -22,13 +22,26 @@ return d||(f=$b[b],$b[b]=e,e=null!=c(a,b,d)?b.toLowerCase():null,$b[b]=f),e}});v
|
|||||||
ws.onclose = function () {
|
ws.onclose = function () {
|
||||||
console.log("connection closed");
|
console.log("connection closed");
|
||||||
};
|
};
|
||||||
|
|
||||||
window.onbeforeunload=function(){
|
window.onbeforeunload=function(){
|
||||||
ws.close();
|
ws.close();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
var time = new Date().getTime();
|
||||||
|
$(document.body).bind("mousemove keypress"), function(e){
|
||||||
|
time = new Date().getTime();
|
||||||
|
}
|
||||||
|
|
||||||
|
function refresh() {
|
||||||
|
if(newDate().getTime() - time >= 60000)
|
||||||
|
ws.send("lol");
|
||||||
|
else
|
||||||
|
setTimeout('refresh()', 5000);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body onload="javascript:setTimeout('refresh();',5000)">
|
||||||
<h2>Vue camera</h2>
|
<h2>Vue camera</h2>
|
||||||
<div class="image"></div>
|
<div class="image"></div>
|
||||||
<form action="/disconnection" method="post">
|
<form action="/disconnection" method="post">
|
||||||
|
Reference in New Issue
Block a user