Browser Synchronization

Disallow synchronization via the browser

If you exclusively use the REST API to create or update TalkJS users and conversations then you may want to disable the ability to create or update via the JavaScript SDK. In the TalkJS Dashboard you will see the two checkboxes under the security settings section that allow you to disable synchronization via the browser - one for synchronizing users, and one for synchronizing conversation data.

Disallow synchronisation controls in TalkJS Dashboard

If user synchronization via the browser is disallowed, the following will not work as it tries to add/update the data via the SDK:

const me = new Talk.User({
id: "123456",
name: "Alice"
})

Instead you can reference a Talk.User using only their ID instead, which will use the details already stored for the user.

const me = new Talk.User(123456);

Similarly if the option to disallow conversation synchronization via the browser is checked, the following will not work as it involves modifying the conversation data using the JavaScript SDK:

// Only if the conversation already exists, this will work
const conversation = session.getOrCreateConversation(
Talk.oneOnOneId(me, other)
);
// Trying to set a participant via the SDK will cause an error
conversation.setParticipant(me);
conversation.setParticipant(other);
// Trying to set the the conversation's attributues will also cause an error
conversation.setAttributes({
subject: 'Hello world!',
});

Check out our tutorial on how to ban a user from all chats that uses Identity Verification together with disabling browser synchronization to ensure integrity of your user's data.