Page 1 of 2
About Java API to simulate Openspace npc problem.
Posted: 10 Jun 2009, 05:37
by ddk2
Hi, bax.
I just complete my npc find path problem with the bug fixed Java API.
but i find some new problem.
the java simulate npc sometimes will lost connect automatic.
And the java output "Connection Lost."
Zhulp
Best regards.
the Shinezone() team.
Posted: 10 Jun 2009, 06:26
by Lapo
The server disconnects idle users after a certain amount of time.
This parameter is configurable via the <MaxUserIdleTime> setting in the config.xml
If you prefer you can send a "keep-alive" message from your NPCs by calling your server side extension, using a dummy message.
Posted: 10 Jun 2009, 06:30
by ddk2
what is the dummy message

Posted: 10 Jun 2009, 09:27
by Lapo
An empty request sent to your server side extension, with no data.
Posted: 11 Jun 2009, 03:24
by ddk2
Must be empty message?
i let my Java npc to find path per 60 seconds.
but my Java npc still will lost connecting "sometimes".
Posted: 11 Jun 2009, 06:02
by Lapo
How did you set the <MaxUserIdleTime>?
As regards the empty extension message, I mean something like this:
java code:
Code: Select all
smartFox.sendXtMessage("gameExt", "ping", new SFSObject());
where
smartFox is an instance of the SmartFoxClient class
This is sufficient to keep the user alive and on the server side you can completely ignore the request.
Posted: 11 Jun 2009, 07:12
by ddk2
I set the <MaxUserIdleTime>300</MaxUserIdleTime>.
And I think does Java API must send empty message to keep alive?
I mean the Java API to simulate NPC will lost connetion sometimes suddenly.
It looks like the sfs kick off the NPC User, or touch sfs kick itself which Java API make something wrong.
Posted: 11 Jun 2009, 08:54
by Bax
ddk2,
your idle time is set to 300 seconds (MaxUserIdleTime config parameter). If your NPC doesn't send requests to SmartFoxServer within that time period, it gets disconnected.
In order to avoid a disconnection, you can send a fake request to your extension, just like in the Lapo's example.
Posted: 11 Jun 2009, 13:11
by ddk2
you mean I must send some message to Extend to keep the connection alive
And the NPC in Openspace which simulated by Java API send the path to move operate is 'can not to keep alive' message, course it dose not send to extends?
Posted: 12 Jun 2009, 06:13
by Bax
Sorry, but I don't understand (for example, why do you say "extend"? the name is "extension").
Are you saying that your java client which simulates an NPC always sends a path to the users within the MaxUserIdleTime?
If no, this could be the reason for disconnection, because the NPC is idle.
If yes, then it shouldn't be disconnected, because when sending the new path to the other clients you are (I suppose) both setting the user variables and sending an object. These two are enough to keep the connection alive.
Posted: 12 Jun 2009, 07:02
by ddk2
bax wrote:Sorry, but I don't understand (for example, why do you say "extend"? the name is "extension").
Are you saying that your java client which simulates an NPC always sends a path to the users within the MaxUserIdleTime?
If no, this could be the reason for disconnection, because the NPC is idle.
If yes, then it shouldn't be disconnected, because when sending the new path to the other clients you are (I suppose) both setting the user variables and sending an object. These two are enough to keep the connection alive.
Yes, I mean the "extends" is the extension.
And I the npc send the new path to other clients is within idle time.
And I mean the npc will lost connection
sometimes suddenly.
Posted: 12 Jun 2009, 07:23
by Bax
It is quite impossible to understand which problem could cause this behavior... not enough clues.
Does the console on the server-side or client-side show any kind of error?
Posted: 12 Jun 2009, 08:54
by patso
btw you mention that it happens sometimes - is there any pattern? For example approximately same time or when you do action X but not always when you do it, etc.
Posted: 12 Jun 2009, 10:35
by ddk2
I find one way to course that:
Java simulate NPC in Openspace will lost connect when the room user who is the Client of swf all is left.
the Java simulate NPC will lost connection.
that is one way to touch.
And I think there is some other way to touch it.
Posted: 16 Jun 2009, 06:29
by patso
ddk2 wrote:I find one way to course that:
Java simulate NPC in Openspace will lost connect when the room user who is the Client of swf all is left.
the Java simulate NPC will lost connection.
that is one way to touch.
And I think there is some other way to touch it.
Can you explain a bit better or to provide the debug log. I've tried several tests with both java and swf clients and I was not able to reproduce issue where a java client is disconnected when swf client leaves the room.