How to check if the browser or app closed?

0 favourites
  • 3 posts
From the Asset Store
This is a single chapter from the Construct Starter Kit Collection and the Student Workbook from the Workshop.
  • Hello friends,

    I am building a chat application which works quite fine in general (server side is coded on Python). The problem is that when the browser or the app is closed, I have to remove the logged in users from the room/system. I could not find a way to handle it, since there is no way to disable close button on Windows or to check if the browser close button is clicked.

    Any ideas to handle this problem on Windows, mobile or browser?

    PS. I implemented a polling system among the clients to remove inactive users periodically. However, it is also not working as intended since the HTML ports are not sending signals to the server when the browser frame is not focused.

    Thanks in advance.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • AFAIK there isn't anything we can do about games not running while unfocused, its a browser/device thing.

    Some things I would try include simply increasing time before kicking, adding an "idle" state if no response received for x time before booting, or automatic reconnectingand updating when focused again. Or you can simply not show the current status of who is online or not.

    Check for javascript solutions too, since you can run scripts directly. Although I imagine scripts running in the background is exactly the kind of thing browsers and mobile devices are actively trying to prevent from happening.

  • Thanks for the answers dear.

    Unfortunately, these are not addressing to a direct solution in my case.

    I almost completed the application, however, it seems there is no efficient way to do it in JS-HTML, I guess :(

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)