how to view meteor DDP traffic?

2019-01-22 20:31发布

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.

1条回答
我只想做你的唯一
2楼-- · 2019-01-22 21:23

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)); 
  });
}
查看更多
登录 后发表回答