Cancel an operation ?

Hello,
is there a way to cancel an operation ? Like i'm creating a room but i want to cancel because it takes too much time or whatever ?
Thank you

Comments

  • Hi @antigode.
    No, there is no such option and it should not be necessary either. All operations are processed instantly when they reach the server. Any cancel-request would take longer than just waiting for the operation to finnish.
  • antigode
    antigode
    edited August 2019
    sorry after few researches, i've found out people already post on this subject: https://forum.photonengine.com/discussion/comment/18064#Comment_18064

    I understand but during my test, when my network is low then the "connection process" does take a while. So it would be obvious that the player with low connection would like to cancel this process to go somewhere else on the menu (play in solo...) rather than staying stuck on the processing screen. Is there any way to bypass this problem ?

    UP: I'm not the only one looking for a solution... https://forum.photonengine.com/discussion/7234/how-to-cancel-ongoing-join-room-attempt
  • Hi @antigode.

    As I said: Any cancel attempt would only ever arrive at the server AFTER the has already been entered. So it is rather pointless to cancel a join or create room operation.
    If your user clicks on the 'cancel' button, then just set a flag bool canceled to 'true' and when the callback has arrived that informs you that you have successfully entered a room, check if the cancel flag is set and if it is, then just immediately leave it again. That is as close as you can get to what you want. However keep in mind that it might not be a great experience for other players if a players joins a room and then cancels, as that means that he occupies a slot for a moment, in which no one else can join, so it takes longer to get the game started and if the last player before starting the game cancels his join, then the game might wither start with one player less then intended or your code has to wait for a moment until every player has confirmed that he is not cancelling, so starting the game would take longer again.

    Bottom line:
    It just does not make sense to cancel once a create or join room operation has been called. The players will have a better user experience if you don't allow cancelling anymore at that point.
    If the connection is really bad, then connecting will already take up to multiple seconds. Another second for the join won't make much of a difference if the player has not already canceled during the connect anyway.
  • hello, sorry for the late reply, i finally set it in stand by and will work on it later. i've though about the solution to leave the room as soon as you enter it but this isn't the solution as you said because it will take longer to do those extra operations. But i was thinking about stopping any operation like "is connecting" which is a transitional state so finally, the player isn't in the room yet. This would throw an exception that i could handle somehow. Anyway this is not very clear right now but i'll see if there is something i can do. Thank you again for your detailed answer.