When the connection closes
Double login
If the same account logs in from another window or from another device, the new access wins. The old connection receives this message:
{ "type": "disconnect", "reason": "duplicate-login" }and then it is closed with code 4001. The message always arrives before the closing.
Server stopping
When the server stops in an orderly way, for example from the panel, every connection receives disconnect with the reason server-stopping and is closed with code 4003. If the server stops all of a sudden, this message is not there and your client sees code 1006.
All the codes
| Code | Reason | When |
|---|---|---|
| 4001 | duplicate-login | Another access with the same account. |
| 4003 | server-stopping | The server is stopping in an orderly way. |
| 4002 | account-suspended | Reserved: the server never sends it today. |
| 1000 | — | Normal closing. The server also uses it to close a single player when one of their messages causes an internal error. |
| 1006 | — | Connection dropped: network lost, server stopped all of a sudden, or a message over 1 MiB. |
If your client closes the connection with a code of its own, the server answers with the same code and closes. A reason your client does not know can appear in the future: show it as text.
Suspended accounts
A suspended account cannot get in: the login answers with auth-error and the reason account-suspended. If instead the account is suspended while the player is already inside, today the server does not disconnect them: they stay in the game until they leave, and at the next login they are refused.
What your client does
- With
duplicate-login: warn the player that they opened the game elsewhere, and do not connect again by yourself, otherwise the two windows keep disconnecting each other for ever. - With
server-stoppingor 1006: you can try again after a few seconds. When you come back, log in again and receive a newwelcome. - After a reconnection the character starts again from the last saved position.
- If a client disconnects all of a sudden, for example because the program is closed, the other players receive
player-disconnectedalmost at once.