Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make TLDraw demo auto-reconnect if backend goes away #6

Merged
merged 1 commit into from
Jan 30, 2025

Conversation

rolyatmax
Copy link
Member

@rolyatmax rolyatmax commented Jan 30, 2025

Updating the demo to make the application reconnect to a new backend if the old one goes away.

Here's how it works:

  1. Pull the session backend spawning logic (i.e. jamsocket.connect()) into an API endpoint that can be called from the client.
  2. Use the endpoint in the client to start a session backend, then listen for when that session backend terminates.
  3. If/when the session backend terminates, hit the API endpoint to start a new session backend and pass the new URL to the TLDraw application.

@rolyatmax rolyatmax requested a review from paulgb January 30, 2025 15:56
Copy link

vercel bot commented Jan 30, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
tldraw-demo ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 30, 2025 4:21pm

Comment on lines +43 to +44
STORAGE_BUCKET: 'tldraw-jamsocket-demo',
STORAGE_PREFIX: docId,
Copy link
Member

Choose a reason for hiding this comment

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

these are only needed locally, right? IIRC on Jamsocket with S3 integration we set them.

Copy link
Member Author

Choose a reason for hiding this comment

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

yeah, that's right

@rolyatmax rolyatmax merged commit 461a23f into main Jan 30, 2025
4 checks passed
@rolyatmax rolyatmax deleted the taylor/reconnect-example branch January 30, 2025 16:25
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.

2 participants