React Native — How to Check What Passes Through Your Bridge?
What is bridge?
Bridge can be overloaded
Most of the time people don’t care about how many and how often they’re passing data to the bridge, which might be a cause of an overload. When the bridge is overloaded, your application will tend to freeze, which happens to be a very frequent case. I always aim at sending as little data as possible because of potential performance issues and I would recommend you to do the same.
Debug with MessageQueue
There is no need to be worried though, let me show you how to check how much data is being passed to the bridge. All you need to do is import <rte-code>MessageQueue<rte-code> from a weird path <rte-code>react-native/Libraries/BatchedBridge/MessageQueue.js<rte-code> and add a <rte-code>spy()<rte-code>function.
When you add this to your application, you’ll see something like the above in your console.
I hope that I’ve managed to help you understand how to debug the bridge in your native module and that now you’ll be able to do it yourself.