Persistly uses optimistic concurrency with baseVersion.
JavaScript Conflict Handling
Treat 409 conflict handling as normal integration behavior.
The JavaScript SDK preserves the canonical server save on conflict. Your game should replace its local canonical snapshot first, then decide how to reapply or discard unsynced local edits.
Conflict Example
Use this pattern for explicit reconciliation.
const result = await client.syncSave(saveId, {
baseVersion: local.version,
metadata: local.metadata,
state: nextState
});
if (result.status === PersistlySyncStatus.Accepted) {
local = result.save;
}
if (result.status === PersistlySyncStatus.Conflict) {
local = result.save;
// decide whether to reapply local unsynced changes or ask the player
}Rules
These are the conflict semantics the SDK depends on.
The server returns explicit conflict semantics instead of silently overwriting state.
Sync responses always return the canonical current save payload.