My application is connected on wifi when I am disabling network I found that disconnection event is not fired on server side . The user remain connected on server side. I have added this in main extension . Using SF2X 2.11.1
addEventHandler(SFSEventType.USER_DISCONNECT, OnUserDisconnected.class);
Disconnection not fired
Re: Disconnection not fired
Hi,
the behavior you're seeing is normal.
Please read this article from our blog to learn more:
http://smartfoxserver.com/blog/what-rea ... tworkwifi/
Hope it helps
the behavior you're seeing is normal.
Please read this article from our blog to learn more:
http://smartfoxserver.com/blog/what-rea ... tworkwifi/
Hope it helps
Re: Disconnection not fired
Thanks for the reply
I found the during my any function execution if server fires any events like disconnect or room join.. server stops execution of function.
why ??
I found the during my any function execution if server fires any events like disconnect or room join.. server stops execution of function.
why ??
Re: Disconnection not fired
Sorry, I am not sure I understand your question.
Server side events will not interrupt your code flow. They run on a separate thread and are handled by the objects you have specified via the addEventHandler() method.
Maybe you can clarify what you mean?
Thanks
Server side events will not interrupt your code flow. They run on a separate thread and are handled by the objects you have specified via the addEventHandler() method.
Maybe you can clarify what you mean?
Thanks
Re: Disconnection not fired
I have a class TurnRequest which extends to BaseClientRequestHandler.. have different function based on turn type.. after disconnection or room join basically when these two server events get fired TurnRequest code execution stops after few second (1-2).. for example in absense of user server timer fires turn type =1 it goes to the TurnRequest Class and stops after few second it stops in middle of any line
Re: Disconnection not fired
35Inside the running task. Cycle: 25
35Inside the running task. Cycle: 26
35Inside the running task. Cycle: 27
35Inside the running task. Cycle: 28
35Inside the running task. Cycle: 29
01:27:30,612 INFO [SocketReader] core.SocketReader - Socket closed: java.nio.channels.SocketChannel[closed]
35Inside the running task. Cycle: 30
01:27:31,937 INFO [Scheduler1-thread-1] sessions.DefaultSessionManager - Session removed: { Id: 5, Type: DEFAULT, Logged: Yes, IP: 202.173.127.48:50218 }
01:27:31,938 INFO [SFSWorker:Ext:3] Extensions -{GAMESFSExtension}: --------------Reached UserDisconnected(handleServerEvent)--------------
01:27:31,938 INFO [SFSWorker:Sys:3] api.SFSApi - User disconnected: { Zone: MyZone }, ( User Name: Mike, Id: 4, Priv: 0, Sess: 202.173.127.48:50218 ) , SessionLen: 74878, Type: Android
01:27:31,939 INFO [SFSWorker:Ext:3] Extensions -{GAMESFSExtension}: disconnected user:Mike
01:27:31,940 INFO [SFSWorker:Ext:3] Extensions -{GAMESFSExtension}: UNKNOWN
35Inside the running task. Cycle: 31
35Inside the running task. Cycle: 32
35Inside the running task. Cycle: 33
35Inside the running task. Cycle: 34
Trace(“Timer Fired Turntype 5”)
01:27:35,558 INFO [pool-19-thread-1577885] Extensions -{GAMESFSExtension}: TurnRequestHandler--->--------------Reached TurnRequestHandler--------------
01:27:35,562 INFO [pool-19-thread-1577885] Extensions -{GAMESFSExtension}: TurnRequestHandler--->TurnRequestHandler-->seatNumber 6
01:27:35,563 INFO [pool-19-thread-1577885] Extensions -{GAMESFSExtension}: TurnRequestHandler--->turnType----> 5
1:27:35,567 INFO [pool-19-thread-1577885] Extensions -{GAMESFSExtension}: TurnRequestHandler-------------------> turnType5
35Inside the running task. Cycle: 26
35Inside the running task. Cycle: 27
35Inside the running task. Cycle: 28
35Inside the running task. Cycle: 29
01:27:30,612 INFO [SocketReader] core.SocketReader - Socket closed: java.nio.channels.SocketChannel[closed]
35Inside the running task. Cycle: 30
01:27:31,937 INFO [Scheduler1-thread-1] sessions.DefaultSessionManager - Session removed: { Id: 5, Type: DEFAULT, Logged: Yes, IP: 202.173.127.48:50218 }
01:27:31,938 INFO [SFSWorker:Ext:3] Extensions -{GAMESFSExtension}: --------------Reached UserDisconnected(handleServerEvent)--------------
01:27:31,938 INFO [SFSWorker:Sys:3] api.SFSApi - User disconnected: { Zone: MyZone }, ( User Name: Mike, Id: 4, Priv: 0, Sess: 202.173.127.48:50218 ) , SessionLen: 74878, Type: Android
01:27:31,939 INFO [SFSWorker:Ext:3] Extensions -{GAMESFSExtension}: disconnected user:Mike
01:27:31,940 INFO [SFSWorker:Ext:3] Extensions -{GAMESFSExtension}: UNKNOWN
35Inside the running task. Cycle: 31
35Inside the running task. Cycle: 32
35Inside the running task. Cycle: 33
35Inside the running task. Cycle: 34
Trace(“Timer Fired Turntype 5”)
01:27:35,558 INFO [pool-19-thread-1577885] Extensions -{GAMESFSExtension}: TurnRequestHandler--->--------------Reached TurnRequestHandler--------------
01:27:35,562 INFO [pool-19-thread-1577885] Extensions -{GAMESFSExtension}: TurnRequestHandler--->TurnRequestHandler-->seatNumber 6
01:27:35,563 INFO [pool-19-thread-1577885] Extensions -{GAMESFSExtension}: TurnRequestHandler--->turnType----> 5
1:27:35,567 INFO [pool-19-thread-1577885] Extensions -{GAMESFSExtension}: TurnRequestHandler-------------------> turnType5
Re: Disconnection not fired
vinod11 wrote:I have a class TurnRequest which extends to BaseClientRequestHandler.. have different function based on turn type.. after disconnection or room join basically when these two server events get fired TurnRequest code execution stops after few second (1-2)..
Do you mean that after a disconnection event if another user calls the "TurnRequest" handler it doesn't get executed?
for example in absense of user server timer fires turn type =1 it goes to the TurnRequest Class and stops after few second it stops in middle of any line
Something is not very clear.
The TurnRequest is a request handler, therefore it is expected to be invoked by the client API and it will send back a reply. That's how a request handler is supposed to work.
Here, however, it looks like you're running a Task of some sort. But I don't understand how the repeating task and the handler are connected... Can you clarify?
Thanks
Re: Disconnection not fired
Another strange thing I noticed in your logs is some thread names such as "pool-19-thread-1577885".
By the look of it, it seems you're running many thread pools or maybe Schedulers? With an awful lot of threads.
Can you clarify how do you use threads in your server side code?
By the look of it, it seems you're running many thread pools or maybe Schedulers? With an awful lot of threads.
Can you clarify how do you use threads in your server side code?
Re: Disconnection not fired
in my game:
1. When two players join a room server send message to them and start a task using ScheduledThreadPoolExecutor that if user does not reply within 35 second play behalf of him and send Extension request to play the turn.
2. If a player (client) sends his move ScheduledThreadPoolExecutor task stops and send user move to TurnRequestHandler. In turn reuest handler according to the recived move new turnrequest is send to the client.
the above process is used for all the turns
not sure I am able to clear the scenario
1. When two players join a room server send message to them and start a task using ScheduledThreadPoolExecutor that if user does not reply within 35 second play behalf of him and send Extension request to play the turn.
2. If a player (client) sends his move ScheduledThreadPoolExecutor task stops and send user move to TurnRequestHandler. In turn reuest handler according to the recived move new turnrequest is send to the client.
the above process is used for all the turns
not sure I am able to clear the scenario
Re: Disconnection not fired
in my case if client does not send his move .. server after 35 second self send extension request ( means in TurnRequstHandler the server sends a turnRequest to self)
this.extension.handleClientRequest("turnRequest ", this.sender, this.params);
this.extension.handleClientRequest("turnRequest ", this.sender, this.params);
Re: Disconnection not fired
At RoomExtension I am using :
public ScheduledThreadPoolExecutor ScheduleService = new ScheduledThreadPoolExecutor(0);
public ScheduledFuture scheduledFutureTask;
in GameManager class
public ScheduledThreadPoolExecutor ScheduleService = new ScheduledThreadPoolExecutor(0);
public ScheduledFuture scheduledFutureTask;
in GameManager class
Code: Select all
if(extension != null) {
if(((SFSRoom)extension).scheduledFutureTask != null){
if(!((SFSRoom)extension).scheduledFutureTask.isCancelled() || kerSFSRoom)extension).scheduledFutureTask.isDone()){
((SFSRoom)extension).scheduledFutureTask.cancel(true);
((SFSRoom)extension).scheduledFutureTask = ((SFSRoom)extension).ScheduleService.scheduleAtFixedRate(new TimedServerRequest(extension, sender, extensionRequest, params,duration), 0, 1, TimeUnit.SECONDS);
}
}
}
TimedServerRequest class In runnable method
if (runningCycles== duration)
{
if(extension != null) {
if(((SFSRoom)extension).scheduledFutureTask != null){
((SFSRoom)extension).scheduledFutureTask.cancel(true);
((SFSRoom)extension).scheduledFutureTask = null;
this.extension.handleClientRequest(this.extensionRequest, this.sender, this.params);
}
}
Re: Disconnection not fired
I am not sure what this code is supposed to do.
Is it supposed to delay the response by waiting for some time?
I feel like your problem is caused by how you're managing all these tasks. Especially because you seem to keep a reference to a task for every Room but what happens when multiple users call the same Room Extension?
Cheers
Is it supposed to delay the response by waiting for some time?
I feel like your problem is caused by how you're managing all these tasks. Especially because you seem to keep a reference to a task for every Room but what happens when multiple users call the same Room Extension?
Cheers
Re: Disconnection not fired
In these type of turnbased games how a Timer should be used.. Sorry I am new in java . I just scheduled a task and take its refrence to room class so that I can cancel it before a new turn .. I feel u are right but I can not figure out how i should do
Re: Disconnection not fired
Just to understand, how many timers (or tasks) does a single Room need at one time?
Thanks
Thanks
Who is online
Users browsing this forum: Google [Bot] and 68 guests