New Login SDK functions: Logout & LogoutCB (For Developers)

image

This is one of the most requested features by our customers using the RumbleTalk Login SDK.

When users have logged in automatically via the Login SDK. They actually inherit the credentials from the chat owner users base and are allowed to login automatically.
However, if the chat owner wishes to force a logout of a user, he was unable to do so.

Now, he can. RumbleTalk is happy to announce a new two Logout options.

Logout

Chat owner can now initiate logout of users using the Login SDK.

To do so, call the following function:

<script type="text/javascript">
rtmq(
    'logout',
    {
        userId: 'USERS_ID', // [optional]
        username: 'USERS_NAME' // [optional]
    }
);
</script>

The [optional] parameters “USERS_ID” and “USERS_ID” are optional and used only to validate that the correct user is being logged out.
They can be used separately or together.
Excluding them will remove the connected user (who’s browser called the function) regardless of their “user id” and\or “username”

Logout Callback

Chat owners can now also listen to the event of a user logout.

To do so, call the following function:

<script type="text/javascript">
rtmq(
    'logoutCB',
    {
        callback: 'CALLBACK_FUNCTION'
    }
);
</script>

The “CALLBACK_FUNCTION” will be called with a “reason” variable when the user logs out of the chat.
An example of the callback function is such:

function (reason) {
    console.log(reason);
    // code to execute on logout
}

currently, the following values are possible for the reason variable:

  • “button_clicked” – the user clicked on the logout button
  • “sdk_request” – the “logout” function of the SDK was called
  • “unknown” – the user disconnected from the chat for an unknown reason (such as network connectivity problems)