Skip to content

Add turbosync example - synchronized video playback with Durable Objects#311

Open
AliSananS wants to merge 1 commit intocloudflare:mainfrom
AliSananS:example/turbosync
Open

Add turbosync example - synchronized video playback with Durable Objects#311
AliSananS wants to merge 1 commit intocloudflare:mainfrom
AliSananS:example/turbosync

Conversation

@AliSananS
Copy link

@AliSananS AliSananS commented Mar 7, 2026

Summary

  • Add TurboSync example: a Next.js app that enables synchronized video playback with friends in real-time
  • Uses Cloudflare Durable Objects for state management and WebSocket-based real-time communication
  • Demonstrates how easily Next.js apps can be deployed to Cloudflare Workers using vinext

Github Repo

https://github.com/AliSananS/turbosync

Live Demo

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: bd0ec7e8ef

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +86 to +87
const slug = toSlug(body.name);
const stub = env.ROOM.get(env.ROOM.idFromName(slug));

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Reject room names that slugify to empty IDs

The create-room handler derives the Durable Object key from toSlug(body.name) but never validates the result, so inputs like "!!!" produce an empty slug and still create a room under idFromName(""). The response then returns slug: "", which causes the client to navigate to /room/ and fail to join via /ws/:roomId, leaving users with a created but practically unreachable room; return a 400 when the slug is empty.

Useful? React with 👍 / 👎.

const existingHostPeerId = await this.ctx.storage.get<string>("hostPeerId");

// If the room is already claimed (has a stored hostPeerId), reject it
if (existingName && existingHostPeerId) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Block re-creation once room metadata already exists

Room ownership conflict is only triggered when both name and hostPeerId are already stored, but hostPeerId is optional on create, so a client can create a room without it and later requests to the same slug can overwrite room data (including password/permissions) before a host joins. This makes room creation non-atomic and allows unintended takeover of an existing room state; treat any existing room record as a conflict (or require hostPeerId at creation).

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant