-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathprotocol.txt
More file actions
53 lines (49 loc) · 1.77 KB
/
Copy pathprotocol.txt
File metadata and controls
53 lines (49 loc) · 1.77 KB
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
events:
* 1 join( [only server -> browser]
user_id : int,
position : [int, int],
color : [int, int, int],
mouse_is_down: bool,
you : bool,
nickname : char[10],
use_pen : bool,
timestamp : int
)
* 2 leave(user_id: int, timestamp: int) [only server -> browser]
* 3 welcome( [only server -> browser]
image_url : string
delta: list of [
x1 : int,
y1 : int,
x2 : int,
y2 : int,
duration : int,
red : int,
green : int,
blue : int,
use_pen : bool
]
messages: list of [
timestamp: int
nickname : string,
message : string
]
)
* 4 change_color(user_id: int, red: int, green: int, blue: int)
* 5 change_tool(user_id: int, use_pen: bool) [use_pen=1: pen; use_pen=0: eraser]
* 6 mouse_move(user_id: int, x: int, y: int, duration: int)
* 7 mouse_up(user_id: int)
* 8 mouse_down(user_id: int)
* 9 chat_message(user_id: int, message: char) [client -> server]
* 9 chat_message(user_id: int, message: char, timestamp: int) [server -> client] <==> the server adds a timestamp to the message before broadcasting it to everyone
* 10 change_nickname(user_id: int, nickname: char) [client -> server]
* 10 change_nickname(user_id: int, nickname: char, timestamp: int) [server -> client] <==> the server adds a timestamp to the message before broadcasting it to everyone
message structure:
* message_type_id
* *parameters
state:
* user_id
* x, y
* r, g, b
* use_pen
* mouse_is_down