-
Notifications
You must be signed in to change notification settings - Fork 0
/
architecture.txt
53 lines (39 loc) · 1.43 KB
/
architecture.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
Message - custom type represeting the message
from User
to User
message (utf-8 string)
messageType (binary, text)
User - custom type represeting a user
Id
In chan Message
Out chan Message
Group - multicast wrapper of users where when a message is recieved
on any user in channel, it multicasts the message to all out channels
for the rest of the users
Id
History - Store for conversations (p2p or groups)
StatusHandler - manages the user connection status
ChangeStatus(for User, status string)
Status(for User) string
Contacts - Stores and manages contacts for each user
AddContact(for User, newContact User)
RemoveContact(for User, newContact User)
ListContacts(for User) []User
Transport - exports (Contact)
- JSON based protocol, WebSocket, HTTP(S), telnet, tcp, etc...
- starts a new go routine with listener for each out channel for each user
and if message is available through the channel, it packs it with the current
protocol implementation and sends it across the network
OnUserConnected
OnUserDisconnected
OnUserStatusChange
authenticate
| Client -> Server protocol |
Message - structure which represents the message communication between
the server and a client
HEADER
from
to
messageType (control, message, file, tmp)
BODY:
transport representation (WebSocket, HTTP, telnet, tcp..)