Is there a way to limit the maximum number of global users able to connect?

Options
I know there's a hard limit that prevents a certain amount of concurrent users from connecting globally to the master server anyway but is there some way I can code in my own limit? For example, If I have 100 max users, can I put in a limit of about 40 if I want to?

Comments

  • JohnTube
    JohnTube ✭✭✭✭✭
    edited February 2019
    Options
    Hi @Lethn,

    You can do so using custom authentication AND a way to know when a player disconnects.

    So custom authentication does two things:

    - count new user connections on your backend
    - do not allow users connections number to exceed a limit you set

    You need a way to detect when a player disconnects from your backend, however, e.g. client keep sending a keep-alive or heartbeat signal to your backend and if a timeout in receiving one is detected consider the player disconnected. You could also send application stats to your backend from the client. Also, you could make use of webhooks, PathLeave, some of the leave reasons show that the player disconnected from the game server unexpectedly so it can count as a disconnect from master server as well.

    Another method is to have a special Photon client in the backend that gets application stats.
  • Lethn
    Options
    Yikes, that looks complicated, I only have 100 users available for use, if the player count goes higher than that will it just shut down the application or will it block other users from joining?
  • JohnTube
    JohnTube ✭✭✭✭✭
    Options
    will it block other users from joining?
    The client will be disconnected with the proper disconnect cause: CCU exceeded.