To start a connection you have to check the versions, generate the sessonID and verify the login. Only if step 1.1 is accomplished and the sessionID of the client was valid or if step 1.1 and 1.2 have been accomplished a usable connection is negotiated.
Client:
{
"version": string,
"sid": string
}
Only sends sid
if client has an old sessionID.
Server:
{
"version": string,
"accept": bool,
"sid": string
}
If accept
is true
the connection is valid. Else the connection will be terminated.
sid
can be set if accept is true
and must be set if the sid
of the client is invalid. So the server gives a new sid
if the session is invalid. The server can as well use no sid
. If the server forbids sid
s but the client is offering one then the connection is to be immediately closed!
Client:
{
"user": string,
"pass": string,
"sid": string
}
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": string
}
Client:
{
"command": "close",
"remembersID": bool
}
remembersID
is optional. If it's true
then the sID shall be remembered by the server. Else it shall be forgotten.
Server:
{
"command": "close",
"response": "bye"
}