{"id":593,"date":"2024-01-28T20:37:13","date_gmt":"2024-01-28T15:07:13","guid":{"rendered":"http:\/\/codetheory.in\/?p=593---1604a87a-8cd1-4f82-a1e3-62bb2fa1018c"},"modified":"2024-01-28T20:37:13","modified_gmt":"2024-01-28T15:07:13","slug":"websocket-traffic-inspection-in-chrome-developer-tools","status":"publish","type":"post","link":"https:\/\/codetheory.in\/websocket-traffic-inspection-in-chrome-developer-tools\/","title":{"rendered":"WebSocket Traffic Inspection in Chrome Developer Tools"},"content":{"rendered":"

Just like debugging any other thing, doing the same for websocket traffic can be really useful. Not sure if firebug does that, but inspecting your websocket traffic in chrome dev tools is definitely possible.<\/p>\n

<\/p>\n

Some Code First<\/h2>\n

Whenever dealing with websockets, I find myself mostly working with Node.js<\/a> and Socket.IO<\/a>. You can setup a quick node server that does websocket data transfer back and forth with socket.io. Check out some code here<\/a> to get started.<\/p>\n

If you are reading this post, then you probably already have an app that’s leveraging the power of websockets to do something in realtime.<\/p>\n

How to Inspect ?<\/h2>\n

Take the following steps:<\/p>\n

    \n
  1. Open Chrome Dev Tools.<\/li>\n
  2. Click Network<\/strong> Tab.<\/li>\n
  3. Filter the traffic by clicking WebSockets<\/strong> in the bottom-most bar.<\/li>\n
  4. Find your proper websocket connection and click it.<\/li>\n
  5. Now you will see a new pane appear with Headers<\/em> and Frames<\/em> tab. Click the Frames<\/strong> tab.<\/li>\n<\/ol>\n
    \"WebSockets<\/a><\/div>\n

    \n<\/span><\/div>\n

    Note: Unfortunately, the Frames pane showing messages does not refresh automatically in realtime. To refresh the data table, click that connection again from the Network<\/em> tab’s Name<\/em> Column.<\/p>\n

    Chrome version used is 22, but I also remember inspecting in Chrome 20 or so.<\/p>\n

    Happy WebSockets Debugging!<\/p>\n","protected":false},"excerpt":{"rendered":"

    Just like debugging any other thing, doing the same for websocket traffic can be really useful. Not sure if firebug does that, but inspecting your websocket traffic in chrome dev tools is definitely possible.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[40],"tags":[64,63],"_links":{"self":[{"href":"https:\/\/codetheory.in\/wp-json\/wp\/v2\/posts\/593"}],"collection":[{"href":"https:\/\/codetheory.in\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/codetheory.in\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/codetheory.in\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/codetheory.in\/wp-json\/wp\/v2\/comments?post=593"}],"version-history":[{"count":7,"href":"https:\/\/codetheory.in\/wp-json\/wp\/v2\/posts\/593\/revisions"}],"predecessor-version":[{"id":184678,"href":"https:\/\/codetheory.in\/wp-json\/wp\/v2\/posts\/593\/revisions\/184678"}],"wp:attachment":[{"href":"https:\/\/codetheory.in\/wp-json\/wp\/v2\/media?parent=593"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/codetheory.in\/wp-json\/wp\/v2\/categories?post=593"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/codetheory.in\/wp-json\/wp\/v2\/tags?post=593"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}