Cross-Platform Messaging Experience
Article Summary
Snap rewrote their entire messaging system in C++ to solve a problem that plagues most mobile teams: platform inconsistency causing bugs and doubled engineering effort.
Two years ago, Snap's messaging team embarked on a complete rewrite to improve performance, cut infrastructure costs, and eliminate behavior differences between Android and iOS. Their solution? Build once in C++ instead of maintaining two separate codebases.
Key Takeaways
- Single C++ codebase handles all messaging logic for both iOS and Android
- Used Djinni to generate consistent Java, Objective-C, and C++ interfaces automatically
- Built cross-platform gRPC client with Cronet and QUIC for identical network behavior
- SQLite provides consistent data storage and schema across both platforms
- Small C++ team now maintains what previously required separate iOS and Android teams
By investing in consistency at every layer (logic, interfaces, networking, storage), Snap ships messaging features faster with fewer bugs and lower maintenance costs.
About This Article
Snap's messaging product needed complex business logic on the client side and careful coordination between client and server to be fast and reliable. But Android and iOS worked differently, which made the code harder to maintain and caused bugs.
Snap decided to put all messaging logic in C++ and keep the presentation layers specific to each platform. Shared data models connect the C++ code to the presentation, network, and storage layers.
The C++ team at Snap can now build new messaging features faster and ensure they work the same way on both Android and iOS without needing platform-specific fixes.