Protocol version: "0.1"
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.
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.
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.
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": "list"
}
Server:
{
"command": "put",
"names": string[],
"remaining": int
}
The server loops this until all names have been sent and remaining
hits 0
.
Client:
{
"command": "put",
"file": string,
"size": int
}
Server:
{
"command": "put",
"accept": bool
}
If accept
is true
the connection is valid and the client can start sending the file. Else the put request was rejected and is hereby canceled.
Client:
{
"command": "put",
"data": string,
"remaining": int,
"cancel": bool
}
data
is a base64 string and contains a piece of the file. The client will loop this until the file is completely sent and the server has to send and received message for every chunk.
remaining
is a counter how many chunks will follow and the transfer is over after it hits 0
.
If cancel
is true
the file transfer will be canceled.
Server:
{
"command": "put",
"recieved": int,
"cancel": bool
}
If cancel
is false
then cancel the upload of the file.
Client:
{
"command": "get",
"file": string
}
Server:
{
"command": "get",
"accept": bool
}
If accept
is true
the connection is valid and the server can start sending the file. Else the get request was rejected and is hereby canceled.
Server:
{
"command": "get",
"data": string,
"remaining": int,
"cancel": bool
}
data
is a base64 string and contains a piece of the file. The server will loop this until the file is completely sent and the client has to send a received message for every chunk.
remaining
is a counter how many chunks will follow and the transfer is over after it hits 0
.
If cancel
is true
the file transfer will be canceled.
Client:
{
"command": "get",
"recieved": int,
"cancel": bool
}
If cancel
is false
then cancel the download of the file.
Client:
{
"command": "close"
}
Server:
{
"command": "close",
"response": "bye"
}