-
Notifications
You must be signed in to change notification settings - Fork 0
/
protocol.txt
61 lines (48 loc) · 919 Bytes
/
protocol.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
JSON-BASED protocol
Client message structure:
{
cmd_type: COMMAND_TYPE,
cmd: COMMANDS,
from: string,
to: string,
expire_period: int, (in seconds)
data_type: DATA_TYPE,
data: bytes | string
}
Server message structure:
{
cmd_type: COMMAND_TYPE,
cmd: COMMANDS,
[status]: STATUS, // if cmd_type is control
from: string,
to: string,
data_type: DATA_TYPE,
data: ....
}
COMMAND_TYPE:
auth,
control,
message,
file,
history
COMMANDS:
register,
auth,
list_contacts,
search_contact,
add_contact,
remove_contact,
create_group,
add_to_group,
remove_from_group,
delete_group,
list_groups,
send_message,
send_file,
get_history
DATA_TYPE:
0 - TEXT,
1 - BINARY
STATUS:
success,
fail