2 min read
Sonar is a cross-platform debugging tool. Hence developers can connect their mobile devices ( Android and iOS or an emulator) to a desktop client for inspection. Sonar works as a guide and interpreter to a running app providing developers with stats on what an app is doing to better understand bugs and system capabilities.
Sonar is now available for the developer community at large, not just Facebook engineers, as an open-source software project via GitHub.
As Sonar was designed with extensibility in focus, it made use of a lot of external plugins. With the open sourcing of Sonar, these plugins are also being open-sourced. Some of these include:
- Logs, a plugin that shows device logs without the need for additional setup.
- Layout Inspector, a debugging platform that provides deep dives into user interface hierarchies and supports Litho and ComponentKit components.
- Network, a plugin that enables the inspection of network packets as they pass into and out of the app in question.
Plugins are available for both Desktop client and Mobile SDK. Desktop client plugins render the UI and a mobile SDK plugin exposes the data. A React component extends the desktop plugin class. This React component is in charge of communicating with the mobile SDK plugin and rendering any data it delivers.
The mobile SDK plugin is developed in the language native to the platform on which it will run ( Swift/Objective-C on iOS or Java/ Kotlin on Android). It registers a set of handlers and defines responses for them.
Source: Facebook Blog
Emil Sjölander, Facebook software engineer hopes that “open-sourcing Sonar and the accompanying plugins will provide a useful tool for other engineers working on mobile applications.” He says that “As we’ve already seen Sonar prove useful internally at Facebook, we think Sonar’s APIs will help other engineers build great new experiences to improve their workflows.”
You can read about the full release coverage on Facebook code blog.