Making our application real time
To show how to use the Channel API, we will add a small feature to our Notes application. If we open the main page in a browser, there is no way for us to realize that a new note was created until we refresh the page. As a note can be created using the inbound e-mail service, it'd be nice to immediately see the change in our browser.
We are going to implement this feature using the Channel API: when we visit the main page, our application will open a channel, which will wait for new notes to be created. We will keep things as simple as possible for the scope of this book, and to avoid writing too much JavaScript code, we won't modify the Document Object Model (DOM) of the page; we will only show a dialog that suggests to refresh the page to see new content as soon as new notes are added.