Events between the Notes server and client code
Socket.IO extends the EventEmitter concept to allow communication, across the network, between the server and client. Before implementing our code, we must know which events our application will require for communicating transactions between the server and client. The exact events for a given application of course are determined by the application needs.
The real-time functions we'll add to Notes will be in the main page, and in the noteview
page. In both cases, there are opportunities for someone else to add, modify, or delete a note which in turn means updating other clients of the change.
With that in mind, ponder over these events:
notetitles
: This event is sent by the Notes home page, from the browser, when it wants to refresh the list of notes. The home page is to send this event when it wants to update itself with the list of note titles. This way as Notes are created, updated, or deleted, the home page can update itself.noteupdated
:...