Log in and Synchronization Across Browser Tabs and Windows [Web Only]

Similar to multi-device login and syncronization described in the previous section, you can also enable your users to log in from multiple browser windows and tabs. All the messages and calls will be synchronized between all browser windows and tabs. This feature is quite useful when you want your users to continue chatting even when they open another page of your website in a new tab, for example, Facebook pop-out chat.

You can use this feature independently or along with multi-device login and syncronization to make your app universally available from multiple devices and even from multiple browser windows. Since all windows and tabs are part of a browser, you don't require to generate extra tokens like multi-device login, you can enable this feature in just one line of code.

mesibo.enableCrossTabSessions(true);

Note that this is a beta feature

Your user can log in from as many tabs or windows as required without any limitations, mesibo will sync all their data including messages, calls, profiles, pictures, files, etc across browser tabs and windows without any extra coding except one line of code to enable it.

For example, when your user will receive a message or a call, she will receive it on all the tabs. Similarly, when the user sends a message, it will be synced to all the tabs and windows.

Enabling Login and Synchronization Across Browser Tabs and Windows

To enable login and synchronization across browser tabs and windows, you need to use the following one-line code before you call mesibo.start(). This function has no effect if called after mesibo.start() and hence you MUST call it before starting mesibo.

mesibo.enableCrossTabSessions(true);
...
mesibo.start();

That's it!

Browser Utility Functions

mesibo also provides some utility functions to facilitate syncing your app data between tabs as explained below.

Share custom objects across Tabs and Windows

You can create and share your app-specific data object across browser tabs and windows. The object should be data-only and must not have any functions.

For example,

var someObject = {};
someObject.name = "Abc";
someObject.city = "Xyz";

mesibo.setUserObject('my_object', someObject);

Once set, all browser windows and tabs can access this object by

mesibo.getUserObject('my_object', function(obj) {
	someObject = obj;
});

Your app can also implement a listener MesiboJS_onUserObject(name, obj) which will be called as soon as any browser window or tab sets an object using setUserObject()

Getting Browser Tab or Window ID

mesibo assigns an ID to each Browser Tab and Window. You can get the ID to uniquely identify your app session.

var id = mesibo.getTabId();