Files
flipper/docs/network-plugin.md
Pritesh Nandgaonkar 8db555b259 Replace sonar with flipper in docs
Summary: Replaces sonar with flipper in the docs of a website

Reviewed By: passy

Differential Revision: D9046564

fbshipit-source-id: 55d03d787489406571ea0b4ac0adbc0daaa95cd4
2018-07-31 14:02:58 -07:00

1.4 KiB

id, title
id title
network-plugin Network

Use the Network inspector to inspect outgoing network traffic our apps. You can easily browse all requests being made and their responses. The plugin also supports gzipped responses.

Network plugin

Setup

To use the network plugin, you need to add the plugin to your Flipper client instance.

Android

import com.facebook.sonar.plugins.network.NetworkSonarPlugin;

NetworkSonarPlugin networkSonarPlugin = new NetworkSonarPlugin();
client.addPlugin(networkSonarPlugin);

OkHttp Integration

If you are using the popular OkHttp library, you can use the Interceptors system to automatically hook into your existing stack.

import com.facebook.sonar.plugins.network.SonarOkhttpInterceptor;

new OkHttpClient.Builder()
    .addNetworkInterceptor(new SonarOkhttpInterceptor(networkSonarPlugin))
    .build();

As interceptors can modify the request and response, add the Flipper interceptor after all others to get an accurate view of the network traffic.

iOS

#import <SonarKitNetworkPlugin/SonarKitNetworkPlugin.h>

[client addPlugin: [SonarKitNetworkPlugin new]]

Usage

All request sent from the device will be listed in the plugin. Click on a request to see details like headers and body. You can filter the table for domain, method or status by clicking on the corresponding value in the table.