如何查看流星DDP流量? [英] how to view meteor DDP traffic?
问题描述
meteor使用DDP而非袜子/ websockets。如何获得浏览器调试控制台中发生的事情的任何类型的视图?在chrome的网络面板中,至少只有一个websocket连接没有关于在其上运行的流量的大量信息。
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.
我知道arunoda的 DDP分析器和代理,但正在寻找其他方法来获取流量的基本信息。我原以为chrome的调试工具会对HTTP以外的协议提供更多的支持,并有兴趣知道其他人认为有用的东西。
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.
推荐答案
您可以尝试将消息记录为一个简单的起点。解析消息会使检查变得更好。
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));
});
}
这篇关于如何查看流星DDP流量?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!