About Java API to simulate Openspace npc problem.
Just to make sure I understand this.
If I want an NPC that isn't regularly logged out, I need to create a server extension that uses createNPC to create a user object. Then to keep the NPC from being logged out for being idle, I must have an instance of a smart fox server client that sends requests to the server on behalf of the NPC? If so does this client have to run as a separate process?
Further Clarifying
So in my extension I do the follow:
User u = extensionHelper.createNPC() to create a user
have u join a room.
Set up a task that gets called every 30 seconds(Assuming the idle timeout > 30).
In this task I send a public message from u.
Should npc u get logged out for being idle?
Or do I need to create a smartFoxClient for u, and have the task do:
client.sendXtRequest("npcManager","ping");
Currently I have it sending a public message every 30 seconds. But the NPC gets logged out for being idle. And I'm not sure if I'm not doing what I need to do to cause the idle timer to reset, or if I have done something else wrong.
User u = extensionHelper.createNPC() to create a user
have u join a room.
Set up a task that gets called every 30 seconds(Assuming the idle timeout > 30).
In this task I send a public message from u.
Should npc u get logged out for being idle?
Or do I need to create a smartFoxClient for u, and have the task do:
client.sendXtRequest("npcManager","ping");
Currently I have it sending a public message every 30 seconds. But the NPC gets logged out for being idle. And I'm not sure if I'm not doing what I need to do to cause the idle timer to reset, or if I have done something else wrong.
Set up a task that gets called every 30 seconds(Assuming the idle timeout > 30).
In this task I send a public message from u.
Just wanted to point out that the keep-alive task could also do nothing besides calling npcUser.updateMessageTime(), which updates the idle timer and avoids disconnection.
If your maxIdleTime is 30 seconds your taks should be running a little faster than that, like 20 seconds.
Return to “Java2SE / Android Client API”
Who is online
Users browsing this forum: No registered users and 25 guests