Created
May 18, 2011 12:28
-
-
Save foogoof/978486 to your computer and use it in GitHub Desktop.
html page to tail system.log over websockets
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script src="/socket.io/socket.io.js"></script> | |
<script type="text/javascript"> | |
var socket = new io.Socket(); | |
socket.connect(); | |
socket.on('connect', | |
function(){ | |
console.log('connected'); | |
socket.send('/var/log/system.log'); | |
}); | |
socket.on('message', function(data){ | |
console.log('messaged'); | |
if (data) { | |
$('fin').scrollTo(); | |
$('mid').insert(data); | |
$('mid').insert("<br/>"); | |
} | |
}); | |
socket.on('disconnect', function(){ alert('disconnected'); }); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment