Fred T-H avatar Fred T-H committed 12f9d88

Adding content about supervised handlers

Comments (0)

Files changed (1)

 Different event handlers attached to the event manager will be dealing with routing messages:
 
 * //usr_dispatch_handler//: Takes messages you send and routes them to another user. There is only one of these per user.
-* //usr_listen_handler//: Takes any kind of message received and transmits it to the client. The format of the message is altered to be {UserId, {received, From, Message}} or {UserId, {sent, To, Message}} so a given process can hold more than one client connection. There is one handler of this kind per client.
+* //usr_listen_handler//: Takes any kind of message received and transmits it to the client. The format of the message is altered to be {UserId, {received, From, Message}} or {UserId, {sent, To, Message}} so a given process can hold more than one client connection. There is one handler of this kind per client and everyone of them is added with gen_event:add_sup_handler/3, which guarantees that if the client dies, the handler also dies.
 
 These two handlers are enough to do all the message routing. Additional handlers could be added to do logging, message history, presence updates, etc.
 
 It is strongly suggested that the whole browser + javascript client part should be thrown into a garbage can to never be considered again. I really need to replace it with something better.
 
 == What's left to be done ==
+* Make the clients aware of a dying user
 * Clean the comments up
 * A better web implementation for long-polling
 * Enabling conversation history for the last few messages 
 * And much more!
 
 === How it's gonna be done ===
-The most important points to extend at the moment are the web implementation and conversation history.
+The first priority should be to make the clients aware of a dying user. This is simple to do given a dying listen handler (which is supervised) will send the message //{gen_event_EXIT, HandlerId, Reason}//. An exit exception should be raised after that.
+
+The next most important points to extend are the web implementation and conversation history.
 
 The web implementation will likely require to start the //web_server.erl// module from scratch and to restart the javascript part from scratch too. I don't really know how I'm going to proceed for the whole thing yet, so we'll see.
 
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.