-
Notifications
You must be signed in to change notification settings - Fork 0
/
HowtoDesignTheChatServer.txt
31 lines (16 loc) · 1.24 KB
/
HowtoDesignTheChatServer.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
1) Through Websockets you can only send a text message as per our requirement. Thus you need to integrate all the active chatrooms inside that text message only. Whatever we are passing need to be sent through that message only.
WebStorage is one of the concepts to be used here. This is a secure way of storing the information.
To Implement Login
Make a HTTP handler, which will check user against DB
To implement SignUp
Make a HTTP handler, which will enter the user info to DB and redirect to the login screen
After user LoggedIn
Open a websocket connection to share messages among multiple processes. Each message will contain the chat Room Name as well as UserName. This allows us to share messages on the basis of chat rooms. This need to be done with websockets only.
Note: The chatting feature need to be implemented using websockets and the login feature can be implemented using HTTP handlers.
******************What you will need*************************8
A gen_server
A DB to store the chatrooms as well as the user details.
Links For using a gen_server
1) http://20bits.com/article/erlang-a-generic-server-tutorial
2) http://www.erlang.org/doc/design_principles/gen_server_concepts.html
3) http://learnyousomeerlang.com/clients-and-servers