Client-Server Protocol.md 1.1 KB

Client-Server Protocol

Protocol version: "0.1"

1. Start a connection

To start a connection you have to check the versions and verify the login. Only if step 1.1 and 1.2 have been accomplished a usable connection is negotiated.

1.1 Version check

Client:

{
	"version": string
}

Server:

{
	"version": string,
	"accept": bool
}

If accept is true the connection is valid. Else the connection will be terminated after the server answered.

1.2 Login

Client:

{
	"user": string,
	"pass": string
}

Server:

{
	"accept": bool
}

If accept is true the connection is valid and the user is logged in. Else the connection will be terminated after the server answered.

2. Sending commands

Commands can be sent by the client after a connection has been negotiated (See 1). Commands can be used unrelated to each other.

2.1 Status command

Client:

{
	"command": "status"
}

Server:

{
	"command": "status",
	"response": string
}

TODO

3. Close connection

3.1 Close command

Client:

{
	"command": "close"
}

Server:

{
	"command": "close",
	"response": "bye"
}