May 2018
Intermediate to advanced
492 pages
12h 3m
English
It's cool how we can now see real-time changes in a part of the Notes application. Let's turn to the /notes/view page to see what we can do. What comes to mind is this functionality:
For the first two features, we can rely on the existing events coming from the Notes model. The third feature will require a messaging subsystem, so we'll get to that later in this chapter.
In routes/notes.mjs, add this to the end of the module:
export function socketio(io) { notes.events.on('noteupdate', newnote => { io.of('/view').emit('noteupdate', newnote); }); notes.events.on('notedestroy', ...Read now
Unlock full access