Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to view meteor DDP traffic?

meteor uses DDP over socks / websockets. How do i get any type of view of what's going on in the browsers debug console? In the network panel of chrome at least there is just a single "websocket" connection without much info on the traffic running over it.

I'm aware of arunoda's DDP analyzer and proxy but was looking for other ways to get basic information on traffic. I would have thought chrome's debugging tools would have a bit more support for protocols other than HTTP, and interested to know what else others find useful.

like image 985
dcsan Avatar asked Aug 18 '14 23:08

dcsan


1 Answers

You could try logging the messages as a simple starting point. Parsing the message makes it a little nicer to inspect.

if (Meteor.isClient) {

  // log sent messages
  var _send = Meteor.connection._send;
  Meteor.connection._send = function (obj) {
    console.log("send", obj);
    _send.call(this, obj);
  };

  // log received messages
  Meteor.connection._stream.on('message', function (message) { 
    console.log("receive", JSON.parse(message)); 
  });
}
like image 145
Neil Avatar answered Oct 16 '22 12:10

Neil