Skip to content

Instantly share code, notes, and snippets.

@aklinkert
Last active January 14, 2019 19:42

Revisions

  1. aklinkert renamed this gist Jul 30, 2015. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  2. aklinkert revised this gist Jul 30, 2015. 1 changed file with 17 additions and 1 deletion.
    18 changes: 17 additions & 1 deletion log_all_socket_events
    Original file line number Diff line number Diff line change
    @@ -1,3 +1,4 @@
    // pre 1.0
    (function() {
    var emit = socket.emit;
    socket.emit = function() {
    @@ -9,4 +10,19 @@
    console.log('***','on',Array.prototype.slice.call(arguments));
    $emit.apply(socket, arguments);
    };
    })();
    })();

    //post 1.0
    (function () {
    var emit = socket.emit,
    onevent = socket.onevent;

    socket.emit = function () {
    console.log('***', 'emit', Array.prototype.slice.call(arguments));
    emit.apply(socket, arguments);
    };
    socket.onevent = function (packet) {
    console.log('***', 'on', Array.prototype.slice.call(packet.data || []));
    onevent.apply(socket, arguments);
    };
    }());
  3. aklinkert created this gist Jan 28, 2014.
    12 changes: 12 additions & 0 deletions log_all_socket_events
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,12 @@
    (function() {
    var emit = socket.emit;
    socket.emit = function() {
    console.log('***','emit', Array.prototype.slice.call(arguments));
    emit.apply(socket, arguments);
    };
    var $emit = socket.$emit;
    socket.$emit = function() {
    console.log('***','on',Array.prototype.slice.call(arguments));
    $emit.apply(socket, arguments);
    };
    })();