PartyKitPersisterConfig
The PartyKitPersisterConfig
type describes the configuration of a PartyKit Persister
on the client side.
{
storeProtocol?: "http" | "https";
storePath?: string;
messagePrefix?: string;
}
Type | Description | |
---|---|---|
storeProtocol? | "http" | "https" | The HTTP protocol to use (in addition to the websocket channel). This defaults to 'https' but you may wish to use 'http' for local PartyKit development. |
storePath? | string | The path used to set and get the whole |
messagePrefix? | string | The prefix at the beginning of the web socket messages sent between the client and the server when synchronizing the |
The defaults (if used on both the server and client) will work fine, but if you are building more complex PartyKit apps and you need to configure path names, for example, then this is the thing to use.
Example
When applied to a PartyKit Persister
, this PartyKitPersisterConfig
will load and save a JSON serialization from and to an end point in your room called /my_tinybase
, and use HTTP (rather than the default HTTPS) as the protocol.
Note that this would require you to also add the matching storePath setting to the TinyBasePartyKitServerConfig
on the server side.
export const partyKitPersisterConfig = {
storeProtocol: 'http',
storePath: '/my_tinybase',
};
Since
v4.3.9