18.4. Traffic Sniffing
Capture, Intercept, Log, Monitor, Network, Record, Sniff, Traffic
Figure 18-12. Traffic Sniffing
18.4.1. Developer Story
How can you diagnose errors and strange behavior?
Diagnose problems by sniffing Web Remoting traffic. Many Ajax problems arise because Web Remoting (Chapter 6) messages are either wrong or are not sent at all. Debugging (see earlier in this chapter) and general Logging on either side of the network might help you infer what's being transmitted, but it's better to grab the traffic directly. There are various ways to do this:
Traffic Sniffing is a kind of Logging function. As such, you'll probably want similar filtering functionality, e.g., to see messages in only one direction, matching certain text, or to a particular URL.
18.4.4. Tool Support
184.108.40.206. XMLHttpRequest Tracing and XMLHttpRequest Debugging
Figure 18-13. XMLHttpRequest Debugging
Fiddler (http://www.fiddlertool.com/Fiddler/dev/) is a Windows proxy specifically designed for analyzing and "fiddling" with browser-server traffic (Figure 18-14).
Figure 18-14. Fiddler
18.4.5. Code Example: Using XMLHttpRequest Tracing
http://blog.monstuff.com/XmlHttpRequestTracing:  intercepted open (GET , patternList.phtml , true , undefined , undefined) http://blog.monstuff.com/XmlHttpRequestTracing:  intercepted send (null)
Then, the result is displayed, showing response code (200) and content:
http://blog.monstuff.com/XmlHttpRequestTracing:  intercepted load: 200 Ajax Stub|||Browser-Side Cache|||Browser-Side Templating|||Browser-Side XSLT||| ....
18.4.6. Related Patterns
Traffic Sniffing in the browser is a form of Logging (see earlier).