- <script>
- $(function() {
- var $body = $('body');
- var lines = 0;
- var log = function (str) {
- if(lines > 66) {
- $($body.children().get(0)).remove();
- } else {
- lines += 1;
- }
- $body.append($('<div>').text(str));
- };
- var socket = io.connect('http://localhost');
- socket.on('write', function (data) {
- log(data);
- });
- });
- </script>