To start a connection you have to check the versions, generate the sessonID and verify the login. Only if step 1.1 is accomplished is and the sessionID of the client was valid or 1.1 and 1.2 have been accomplished a usable connection is negotiated.
Client:
{
"version": "versionstring",
"sid": "sessionID"
}
Only sends sid
if client has an old sessionID.
Server:
{
"version": "versionstring",
"accept": bool,
"sid": "sessionID"
}
If accept
is true
the connection is valid. Else the connection will be terminated.
sid
must be set if accept is true
and if the sid
of the client is invalid. So the server gives a new sid
if the session is invalid.
Client:
{
"user": "username",
"pass": "password",
"sid": "sessionID"
}
Server:
{
"accept": bool
}
If accept
is true
the connection is valid and the user is logged in. Else the connection will be terminated.
The server is not obligated to send sid
back.
Commands can be sent by the client after a connection has been negotiated (See 1). Commands can be used unrelated to each other.
Client:
{
"command": "status"
}
Server:
{
"command": "status",
"response": "command response"
}