Hey fellow smartfox-lovers,
I do have a problem that occurs very often for me.
If a user is logged on to smartfoxserver and then his internet connection is disconnected he is not disconnected from smartfoxserver. So when he tries to log in again he gets a "user name already taken" response.
How do i allow this user to log in now?
I could set the idleTimeout lower, but i dont want that to be too low, because in my games the users sometimes hae to wait a file until a game for them fires... And i dont want them to be disconnected while queued for a game...
Please help me...
Daniel
User Name already taken
Hi dvine,
i recognized the same problem. If the internet-connection is slow and the user disconnects he will be disconnected from the room, but not from the zone.
The point is, that you can't join the same user (same nick) into a zone again.
I solved it this way. when the user logs in, he will be loged in with his nick and a random, maybe uniqueId. So you can substring the Id, you have the "real" name, but internal he'll alyways be a "unique user".
the other user, who wasn't really disconnected from the zone will be kicked, after the idle time.
cheers
froesi
i recognized the same problem. If the internet-connection is slow and the user disconnects he will be disconnected from the room, but not from the zone.
The point is, that you can't join the same user (same nick) into a zone again.
I solved it this way. when the user logs in, he will be loged in with his nick and a random, maybe uniqueId. So you can substring the Id, you have the "real" name, but internal he'll alyways be a "unique user".
the other user, who wasn't really disconnected from the zone will be kicked, after the idle time.
cheers
froesi
It is necessary that you lower the idle value in the config to allow SmartFoxServer clean up ghost connections.
In order to avoid that the server disconnects users that are playing or interacting you can simply send a small "ping packet" to the server every once in a while.
Example: you can set the maxIdle time to 1-2 minutes and send the "ping" request every 50 seconds.
This way active clients will never be disconnected and ghost connections will be cleaned by the server
hope it helps
p.s. the "ping" request can be an empty (no params) JSON/Raw request
In order to avoid that the server disconnects users that are playing or interacting you can simply send a small "ping packet" to the server every once in a while.
Example: you can set the maxIdle time to 1-2 minutes and send the "ping" request every 50 seconds.
This way active clients will never be disconnected and ghost connections will be cleaned by the server
hope it helps
p.s. the "ping" request can be an empty (no params) JSON/Raw request
Hey Lapo,
thanks for your response. I tried to follow your instructions and added this to my application:
But I still get disconnected after the Idle-Timeout. What am I doing wrong?? Do I have to actually declare an Extension for this on the Server Side?
Greetings
Dan
thanks for your response. I tried to follow your instructions and added this to my application:
Code: Select all
myDontDropInterval = setInterval(dontDropMe, 30000);
function dontDropMe() {
smartfox.sendXtMessage("X","X")
}
But I still get disconnected after the Idle-Timeout. What am I doing wrong?? Do I have to actually declare an Extension for this on the Server Side?
Greetings
Dan
Title bit offtopic:
Using idle is very good habit but I need a force login. Of course there is always a way(we are talking about java - with java everything is possible ) but it's a good to do it using the best one according to performance and security.
I going to ask for one very simple variant - I suppose that there is some pitfall - otherwise it's too good to be true .
So my idea is to to get the old user object(I mean to get the user object that represents the user with the old connection) and to do the follow:
Are there pitfalls in using this?
Using idle is very good habit but I need a force login. Of course there is always a way(we are talking about java - with java everything is possible ) but it's a good to do it using the best one according to performance and security.
I going to ask for one very simple variant - I suppose that there is some pitfall - otherwise it's too good to be true .
So my idea is to to get the old user object(I mean to get the user object that represents the user with the old connection) and to do the follow:
Code: Select all
extensionHelper.disconnectUser(user);
Are there pitfalls in using this?
we can't reproduce the problem.
we tested the same scenario:
- server maxIdleTime = 120 seconds
- client sends a ping message every 30 sec
connection goes on forever and client never gets disconnected
You either have a problem with config/code or you're using an old version of the server which had that bug.
we tested the same scenario:
- server maxIdleTime = 120 seconds
- client sends a ping message every 30 sec
connection goes on forever and client never gets disconnected
You either have a problem with config/code or you're using an old version of the server which had that bug.
I have this same issue - users being disconnected by their ISP then getting the username taken error.
The workaround being suggested makes the idletime useless.
If you send a ping every 30 seconds, then a user is never idle. I still want someone who is idle for 10 minutes to be logged out.
Any ideas?
The workaround being suggested makes the idletime useless.
If you send a ping every 30 seconds, then a user is never idle. I still want someone who is idle for 10 minutes to be logged out.
Any ideas?
- mistermind
- Posts: 131
- Joined: 15 Sep 2007, 01:33
- Contact:
If you send a ping every 30 seconds, then a user is never idle. I still want someone who is idle for 10 minutes to be logged out.
NO, if the user connection stales and becomes a ghost connection the server will destroy it.
This marks the difference between an active client (pinging) and ghost one(not pinging anymore)
- mistermind
- Posts: 131
- Joined: 15 Sep 2007, 01:33
- Contact:
SmartFoxBasic 1.5.5, 500 users license
I've noticed most of the most interesting updates go to the PRO, but since there is not much use for me right now of that version I'm sticking with that one.
The other thing that worries me is possible migration problems, but besides that is just the fact that currently my game doesn't require the amazing power of the SFS PRO
I've noticed most of the most interesting updates go to the PRO, but since there is not much use for me right now of that version I'm sticking with that one.
The other thing that worries me is possible migration problems, but besides that is just the fact that currently my game doesn't require the amazing power of the SFS PRO
Return to “SmartFoxServer 1.x Discussions and Help”
Who is online
Users browsing this forum: No registered users and 25 guests