跳到正文
文章中级

用 Durable Objects 中的 SQLite 构建选座应用

使用 Durable Objects 内置的 SQLite 构建航班选座应用,并通过 WebSocket 向所有客户端实时同步座位状态。

最近更新
2026年10月12日
阅读原文

该介绍目前仅提供英文版本。

Users book seats for a flight, and each flight is coordinated by a Durable Object that stores its seats in the SQLite storage backend. Durable Objects make it straightforward to handle coordination and state for many clients at once.

What you’ll learn

  • Create a table per flight in Durable Object SQLite
  • Add booking methods to the Durable Object
  • Handle WebSocket connections for live updates
  • Test and deploy

Cloudflare products used

Durable Objects, Workers.

Follow the full, step-by-step tutorial in Cloudflare’s documentation.

继续学习