Kick player if the App (Android) is paused/in background

The whole answer can be found below.

Please note: The Photon forum is closed permanently. After many dedicated years of service we have made the decision to retire our forum and switch to read-only: we've saved the best to last! And we offer you support through these channels:

Try Our
Documentation

Please check if you can find an answer in our extensive documentation on PUN.

Join Us
on Discord

Meet and talk to our staff and the entire Photon-Community via Discord.

Read More on
Stack Overflow

Find more information on Stack Overflow (for Circle members only).

Write Us
an E-Mail

Feel free to send your question directly to our developers.

Kick player if the App (Android) is paused/in background

AndreWe
2021-12-17 03:54:18

Hi,

I want to kick a player, even if the app (android) of that player is in background, e.g. paused.

I tried sending RPC/RaiseEvent and PhotonNetwork.CloseConnection + EnableCloseConnection = true. The PhotonNetwork.KeepAliveInBackground is set to 5 minutes.

Maybe this is because the message queue for incoming messages is not handled if the app is paused. Is there a way to start another background thread etc. which can maybe read certain messages while in background. Or, is there a way to tell the server (without plugin), to close the connected (maybe via a scripting-hook or the like)?

Thank you.

Regards

André

Comments

Tobias
2021-12-21 13:33:13

PUN 2 had a built-in event sent to someone to please kindly leave the room but as you figured out, this could be ignored or does not always work (if that person is in background or not dispatching messages). We disabled this in a recent PUN 2 update but it could be enabled and used with the known limitations.

There is no built-in server-side kick feature. It would be extremely easy and powerful to exploit.

If you wanted to have this, you'd have to implement a Photon Server Plugin and customize the logic server side.

AndreWe
2021-12-21 13:43:27

Thank you. I guess we will leave it like it is for now and will add the Server Plugin in the mid term.

Back to top