How do I disconnect a user in Voximplant from logged_in status? - voximplant

The client state is logged_in. How can I disconnect a user state from voximplant side because I want to login again loginwithpassword() function

You can use client.disconnect() method
https://voximplant.com/docs/references/reactnative/voximplant/client#disconnect

Related

How could I detect when an unauthenticated user leaves a public channel in laravel websockets?

I have a Laravel/Angular application that doesn't require any Authentication to use (An online Scrabble game) Whenever a guest connects with a username (the only constraint is that the username is unique) I register him to the database and Connect him to a Public channel for WebSocket that contains other players (for matchmaking).
I need to detect whenever a player suddenly leaves the game (Ex: loses connection) and I need to do that server side, is that possible ?
I have managed to trigger an event whenever a user leaves a channel using ArrayChannelManager->removeFromAllChannels I can get the SocketId out of that event but I have no idea which user triggered it
class LeaveEvent extends ArrayChannelManager
{
public function removeFromAllChannels(ConnectionInterface $connection)
{
error_log($connection->socketId);
}
}
Note: I cannot use a Presence channel because I have no authentication.

What is the point of this "token" in IndexedDB firebase-messaging-store

I am confused, Can i use this token (stored in indexedDb) for subscribe the device to topics or sending push notifications to device ?
What is the point of this token ?
Best Regards
Thanks
Most likely this database is how the Firebase Cloud Messaging client stores the device token. This is however not documented, so you should not rely on this database entry existing.
Instead, if you want to use the token (to subscribe to a topic or for another cause) use the public API to get the token:
messaging.getToken().then((currentToken) => {
...
});
The above may read the token from the indexeddb, but it may also actively get the token from a call to the FCM servers.
As Frank said,
const localStorageKey = 'webpush';
messaging.getToken().then((currentToken) => {
if (localStorage.getItem(localStorageKey) !== currentToken) {
localStorage.setItem(localStorageKey, currentToken);
}
...
});
Firebase stores token in indexed db. When the token refresh IndexedDb will take the updated token.
Theese tokens are exactly same.
My token changes because my service worker unregister on every page refresh (in dev. mode it is weird). Then it registering again. So, if service worker status is unregistered firebase going to create new token. But in production mode service workers work well.

How to display user a message on session timeout

I'm implementing an adapter base authentication and trying the session timeout functionality I have updated "worklight.properties"and session timeout is working.
So whenever there is session time out or user clicks logout the logout function is called in CustomLoginModule. This works as expected but is there any way I can find in this logout methods why this method was invoked I mean user clicked logout vs session time out. And also how can I pass this info to the client side.
We have a requirement to display user message on session time out.
MobileFirst 7.1
There is no method provided by IBM MobileFirst to differentiate between a logout made by a user action (clicking "logout") to a logout that happened due to a timeout. This is custom functionality you will need to implement on your own.
If you a user clicks on "logout", store this action as a boolean flag and display the appropriate action.
Based on the value of the flag, you can then decide what message to display in case of a session timeout.

IBM Worklight 6.1.0.1, trouble with 2 adapters based authentication

I am facing to a trouble with 2 adapters based authentication. My app is agenda (hybrid app). All adapter's functions must be protected by security.
my app uses adapters based authentication, like written in samples on DeveloperWorks.
My first adapter (loginAdapter) is dedicated for login (beginning of the mobile app). I developed a handler (handlerLogin, mobile side) with methods isCustomResponse, handlechallenge, etc.. This adapter works.
This adapter allows to get a userId from login and password.
As soon as connected, the user can download his agenda. The mobile calls an other adapter based auth (calendarAdapter). I have an other handler (handlerCalendar) with methods (isCustomResponse, handlechallenge).
When the mobile calls the method getCalendarData (protected method, CalendarAdapter), the server detects that the user is not registered for this adapter, that is why the server send an error (structure authrequired + errorMessage) via the function onAuthRequired.
At this step, all works fine.
Actually, the trouble comes from, that, the first handler (handlerLogin) catches this error, whereas it schould be the second handler (handlerCalendar).
Given that it is catched by the handlerLogin, isCustomResponse and handlechallenge are called, and I do not have the expected result ! I do not know why.
Why it is not catched by the handlerCalendar ?
I verified my code, variable's names, files, etc.. All things are ok.
For informations, I first declared the handlerLogin before the CalendarLogin.
Do you have any ideas, suggestions ??
Thank you in advance
It looks like you used the same realm.
The isCustomResponse function job is to find out if this challenge-handler should take care of this specific request. If you use the same realm for both adapters then the 2 challenge-handlers will react to it.

quickblox auto relogin after disconnection

I would like to have my QBchat automatically be logged back in if it is disconnected. When I attempt to send a message and I am logged out, is their a callback function that I can implement to test if I am logged out? Also, if I am correct we must have a session establish with QB, than we log into our QBUUSER, than we must log into our QBChat to send messages? How can reconnect all of these pieces if I lose connection.
In case of logout this method will be called
- (void)chatDidFailWithError:(int)code;
where code will be 0
ChatDidFailWithError is a QBChat delegate method and checks for an active chat instance. If the chat has indeed failed auto-login with the user credentials saved in the DataManager singleton. (Example of which is in the QuickBlox framework's documentation)
(void)chatDidFailWithError:(NSInteger)code {
// recall user credentials from singleton class DataManager
[[QBChat instance] loginWithUser:[DataManager shared].currentUser];
}