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 is disallowed, the following will not work as it tries to add/update the data via the SDK:

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 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
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!"