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.


If user synchronization via the browser, the following will not work it tries to upsert (insert if it doesn't exist, or update it it does exist) the data:

var me = new Talk.User({
    id: "123456",
    name: "Alice"
    email: "[email protected]"

Instead you can create a Talk.User by simply specifying a that already exists using their ID, which will use the details already stored for the user.

var me = new Talk.User(123456)

Similarly if the option to disallow conversation synchronizationn via the browser is enabled, 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
var conversation = talkSession.getOrCreateConversation(Talk.oneOnOneId(me, other));

// Trying to set a participant via the SDK will cause an error

// Trying to set the the conversation's attributues will also cause an error
    subject: "Hello world!"