I don't know any way from the api, but you could just send a "You have to disconnect" message.
I'd do it that way:
1 2 3 4 5 6 7 8 9 10
| public class Message { public static final byte DISCONNECT = 1; public static final byte WHATEVER = 2;
public byte msgValue; } |
With int and Kryo's variable length encoding you get 0-128 in 1 byte, 0-16384 in 2 bytes, etc. If you want to save space, you can use a different class for each message. In the above, KryoNet will send 1 byte (variable length int) to identify the Message class, then 1 byte for msgValue. You probably want to use separate classes anyway, as each class can have different fields. So I would use this:
1
| public class Disconnect { } |
When the client receives that, she disconnects.