Posted in

QCon London: Netflix 使用服务器驱动通知节省时间和成本_AI阅读总结 — 包阅AI

包阅导读总结

1. `Netflix`、`Server-Driven Notifications`、`UMA`、`CLCS`、`Developer Time Saving`

2.

– 在 QCon London 2024 上,Christopher Luu 介绍了 Netflix 如何利用服务器驱动的通知节省时间和金钱。

– 讲述了其优势,如跨平台复用、更好测试等,也提到了存在的挑战,如保持向后兼容、支持离线等。

– 还介绍了相关技术,如 CLCS、Hawkins 及测试策略。

3.

– Netflix 使用服务器驱动的 UI 进行丰富的通知

– 通知用于告知用户重要事件,如支付失败或促销

– 可在服务器更新 UI,无需应用更新,能跨平台共享逻辑和有效进行 A/B 测试

– 开发者可在任何平台创建通知,不受平台和语言知识限制

– 存在的问题

– 通知框架创建的前期成本高

– 需保持框架与旧版应用的向后兼容

– 支持离线应用和调试通知更具挑战

– 部分开发者不喜欢非原生开发

– 相关技术

– 称为 UMA,使用 Hawkins 视觉设计系统,协议为 JSON

– 构建 CLCS 作为 Hawkins 的包装器,抽象后端逻辑

– 旧版本通过 GraphQl 请求 UMA,新组件有回退方法

– 测试策略

– 先使用基于演示的测试,包括硬编码 UMA 的演示服务器

– 还运行后端模板快照测试和传统端到端测试

思维导图:

文章地址:https://www.infoq.com/news/2024/07/netflix-server-driven-ui/?utm_campaign=infoq_content&utm_source=infoq&utm_medium=feed&utm_term=global

文章来源:infoq.com

作者:Karsten Silz

发布时间:2024/7/24 0:00

语言:英文

总字数:669字

预计阅读时间:3分钟

评分:91分

标签:服务器驱动 UI,Netflix,跨平台开发,A/B 测试,向后兼容性


以下为原文内容

本内容来源于用户推荐转载,旨在分享知识与观点,如有侵权请联系删除 联系邮箱 media@ilingban.com

At QCon London 2024, Christopher Luu explained how Netflix uses server-driven UIs for rich notifications. Thissaves developer time through reuse across platforms and better testing but adds effort to maintain backward compatibility. Developers write notifications by embedding so-called Customer Lifecycle Component System (CLCS) components in JavaScript, similar to how React UIs embed HTML in JavaScript.

Notifications in Netflix apps tell users of important events, such as payment failures or promotions. Server-driven notifications allow Netflix to update the UI on the server without app updates, to share logic across the many platforms that Netflix supports, and to run A/B tests effectively. Developers can also create notifications on any platform, independent of their knowledge of platforms and programming languages.

The downsides are higher upfront costs for creating the notification framework and the need to keep the framework backwards compatible with older Netflix apps. It’s also more challenging to support offline apps and debug notifications. Finally, some developers do not enjoy non-native development.

Netflix calls a notification UMA – Universal Messaging Alert. UMA runs on TV, web, iOS, and Android. Except for the web, all these platforms require Netflix to get approval for app updates from the TV vendor, Apple, or Google. That’s where CLSC components, the server-driven UMA, save time & money: the same code runs on all platforms without app updates or approval. Still, Netflix only delivers UMA with these server-driven UIs: The apps use native, client-side UI frameworks for all other functionality.

UMA uses Hawkins, a visual design system named after the town from the Netflix show “Stranger Things”. UMA uses an existing state machine and supports multistep interstitials with forward/backward navigation, such as updating payment information. The wire protocol is JSON.

Netflix did not want to reinvent HTML for UMA, so they built CLCS as a wrapper around Hawkins. CLCS abstracts backend logic away from the apps that render the UI with native UI controls and collect user input. It offers UI components like stacks, buttons, input fields, and images, as well as effects such as dismiss or submit.

Here is a CLCS example:

export function showBox(): Screen {  return (    <Modal>      <VerticalStack>        <Text typography='title' content='Come back next week' />        <Text typography='body' content='Please tune in next week to hear                Statler & Waldorf say: What do you call                 an offline phone? - Notflix!' />      </VerticalStack>    </Modal>  );}

The Netflix apps are responsible for the layout of notifications, such as landscape vs. portrait, positioning, and size. The apps still send information to the server in request headers, such as the app version and device information so that UMA may take advantage of this. Developers can create new CLCS components by combining other components with templates.

UMA still has to support old versions without CLCS. Why? Because Netflix has the challenge of supporting old app versions that will never be updated: mostly phones and tablets with OS versions that Netflix doesn’t support anymore, but also TVs running older app versions. That’s where GraphQL comes in: apps use GraphQL to request UMA from the server. Thisallows for the introduction of new features that older clients ignore, as they still ask for the old components. Additionally, new components specify a fallback method, which builds an alternate version with CLCS baseline components. Baseline components are guaranteed to be there.

Offline devices are not a major issue today, as offline devices cannot query the server for UMA. Still, Netflix may bundle some UMA as JSON in future app versions so that some notifications still show offline.

UMA uses demo-based tests for automated tests first. Here, a demo server delivers hard-coded UMA. Because it’s clear how the Netflix app should render these, testers can take screenshots of the client app or run more specific integration tests. Netflix also runs backend template snapshot tests and traditional end-to-end tests.

Looking back, Luu listed a few things he wished he had finished earlier. These included the baseline components, a formalized testing strategy, better alignment with the design system partners, and alignment with the platforms on templates.