Commits

Fred T-H committed 94f6d5b

fffffffffffuuuuuuuu

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 and everyone of them is added with gen_event:add_sup_handler/3, which guarantees that if the client dies, the handler also dies.
+* //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 each 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.