Snapchat Dec 17, 2021

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

Critical Insight

By investing in consistency at every layer (logic, interfaces, networking, storage), Snap ships messaging features faster with fewer bugs and lower maintenance costs.

The article reveals their specific decision framework for what goes in C++ versus platform code, plus the performance improvements they made to Djinni that are now open source.

About This Article

Problem

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.

Solution

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.

Impact

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.