iossocketswebsocketcharles-proxycfnetwork

How to inspect websocket traffic with charlesproxy for iOS simulator/devices


I would like to inspect network traffic going through web sockets, I have no control over the networking code as this is a binary lib for which I do not have the source code, so I cannot do any log/breakpoint in the networking part of the code.

I have tried using the latest version of CharlesProxy which claim to be able to sniff websockets however when I tried the url and apis using websockets were not even mentionned in the list of endpoints called from my iPhone.

Version 3.11 release notes

I have verified that CharlesProxy is configured correctly as I am able to inspect non-websocket traffic even under SSL.

So my question is: did anyone find a solution to inspect traffic going through websockets with CharlesProxy?

Note: I have ATS disabled when using iOS9

Thanks!


Solution

  • I finally found the answer.

    Charles 3.11.2 works perfectly with WebSocket.

    I use socketIO, so I've already seen http requests sent during the negotiation phase, but I missed websockets traffic.

    In the beginning, socketIO try to use polling then switches to use websockets.

    The websocket traffic is visible when you go to the request with status: "Sending request body" which is actually wss:// request.

    You even have a dedicated tab for this kind of traffic. The rest of messages will appear right there.

    enter image description here

    PS1. Ensure you're connected to socket properly then it appears in Charles.
    PS2. I suggest using socketIO it's a great enhancement for full-duplex traffic like websockets.