I'm developing mobile application using Flutter/Dart. What I need is to debug/test my application's network traffic with Charles proxy/Fiddler. It's easy to inspect http requests/responses in dart/flutter using Charles proxy. We only need to tell HttpClient an address of proxy server (IP address of machine where Charles is installed) like this:
final client = HttpClient();
client.findProxy = (uri) {
String proxy = '1.2.3.4:8888';
return "PROXY $proxy;";
};
client.badCertificateCallback =
((X509Certificate cert, String host, int port) => Platform.isAndroid);
But how can I debug WebSocket traffic created via
WebSocket.connect('wss://server_address');? WebSocket doesn't have any api for setting proxy settings and I couldn't find anything on forums.
That being said, I already did such things in the past in another mobile app written on C# and it was pretty easy.