Nyra Studios
Manual under construction. Some parts are incomplete or may change.

When the connection closes

Nyra 0.5.4.28

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:

json
{ "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

CodeReasonWhen
4001duplicate-loginAnother access with the same account.
4003server-stoppingThe server is stopping in an orderly way.
4002account-suspendedReserved: 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-stopping or 1006: you can try again after a few seconds. When you come back, log in again and receive a new welcome.
  • 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-disconnected almost at once.