Add clientside function to disconnect from server with a message.
Details
Just like game.KickID() allows the server to kick the player with a reason, before they are fully connected, it would be nice to have a game.Disconnect() function allowing a client to purposefully disconnect from a server with the same popup a kick would.
My usecase is to disconnect the player from the server if they have HTTP disabled, as my server heavily relies on it.
While I could just RunConsoleCommand("disconnect"), that command doesn't allow us to give a reason that would be displayed to the player.
I could wait for the player to fully connect and then send a message to the server so it kicks the player, but I'd like to avoid them being fully connected, as it starts up multiple flows on a backend. Furthermore, it would be useless to have players download content and such when connecting just to be kicked. This way, if a player really doesn't want to play on a server requiring HTTP, they won't have to wait for no reason.
game.Disconnect(string reason) would be perfect as a Client only function.
I could wait for the player to fully connect and then send a message to the server so it kicks the player, but I'd like to avoid them being fully connected, as it starts up multiple flows on a backend.
This is a problem in and of itself. The client can spoof this function or even prevent these outgoing requests with some sort of a proxy. The best solution is to handle these cases and validate them on the server side.
Furthermore, it would be useless to have players download content and such when connecting just to be kicked.
The content is downloaded before clientside lua is initialized anyway.
If a client decides to fake the net message, their loss. They'll just ruin their gameplay.
Woops on the content part, you're right, forgot about that.