Sending, displaying, and deleting messages

Note that these code snippets are wrapped with {{#if}} statements, so that certain user interface elements are displayed only to sufficiently privileged users. A user that isn't logged in certainly shouldn't be able to post a message.

Now we have a lot of Socket.IO code to add:

{{#if notekey}}{{#if user}}<script> $(document).ready(function () { ... });{{/if}}{{/if}}

There's another code section to handle the noteupdate and notedestroy messages. This new section has to do with messages that manage the comments.

We need to handle the form submission for posting a new comment, get the recent messages when first viewing a note, listen for events from the server about new messages or deleted messages, ...

Get Node.js Web Development - Fourth Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.