UseSyncOptions

See source code
Table of contents

Options for the useSync hook.

interface UseSyncOptions {}

Properties

assets

The asset store for blob storage. See .

If you don't have time to implement blob storage and just want to get started, you can use the inline base64 asset store. Note that storing base64 blobs inline in JSON is very inefficient and will cause performance issues quickly with large images and videos.

assets: TLAssetStore

uri

The URI of the multiplayer server. This must include the protocol,

e.g. wss://server.example.com/my-room or ws://localhost:5858/my-room.

Note that the protocol can also be https or http and it will upgrade to a websocket connection.

Optionally, you can pass a function which will be called each time a connection is established to get the URI. This is useful if you need to include e.g. a short-lived session token for authentication.

uri: (() => Promise<string> | string) | string

userInfo

optional

A signal that contains the user information needed for multiplayer features. This should be synchronized with the userPreferences configuration for the main <Tldraw /> component. If not provided, a default implementation based on localStorage will be used.


Methods

getUserPresence

optional

A reactive function that returns a TLInstancePresence object. The result of this function will be synchronized across all clients to display presence indicators such as cursors. See getDefaultUserPresence for the default implementation of this function.

Parameters

NameDescription

store

user

Returns


Prev
UseSyncDemoOptions
Next
ActionsProviderProps