Closed caracal7 closed 3 years ago
In most cases its work good but sometimes maybe then client (Mac on local network) goes sleep,
This is where heartbeats are meant to kick in, and the server triggers the disconnect call. What timeout parameters do you have?
all is default
const server = new Deepstream({
logLevel: 'INFO',//'DEBUG',
httpServer: {
type: 'default',
options: {
port: 6020,
host: config.host,
allowAllOrigins: true,
ssl: {
key: keyFile("privkey.pem"),
cert: keyFile("fullchain.pem"),
}
}
},
});
Maybe I didn't understand the problem right. Once I failed to connect with login without any other connected clients. And seems like clientData
not passed to the client. Only reason passed.
this code
client.login( { username, password }, (success, clientData) => {
if( success ) resolve(client);
else {
console.info(clientData);
reject(Error(clientData.reason));
}
})
produce
{reason: "INVALID_AUTHENTICATION_DETAILS"}
What is the server logs? My feeling is your most likely doing something wrong rather than this being a bug since it looks like the server is refusing you access
What is the server logs? My feeling is your most likely doing something wrong rather than this being a bug since it looks like the server is refusing you access
I've added more console info to server but I can't reproduce problem because its happens very rare
I think its not server itself. I think my code is refusing
if( users[authData.username] ) return restrictUser(authData.username, 'Already logged in');
But I need clientData
returned to client to confirm that.
My code is
function restrictUser(username, error = 'Incorrect login/password') {
console.log(`[${username}] restricted: ${error}`);
return {
isValid: false,
id: username,
clientData: { error }
}
}```
Any ideas why I didn't receive `clientData` on client?
Will need to look into this 👍
Be great if you can contribute a tiny project / gist so we can easily run this to reproduce.
Hi, I'm closing this for now due to inactivity. Feel free to reopen if problem persist and share some code to replicate.
I do it this way
In most cases its work good but sometimes maybe then client (Mac on local network) goes sleep, onClientDisconnect is not fired and user can't connect because server thinks user is connected.
Is there a more reliable way to check is client already Logged In?