HTML and CSS Reference
In-Depth Information
And as simple as that we have a fully realtime enabled blog commenting system and we
only send messages to users who really need to see them. As with the AJAX functionality the
realtime functionality has been added in a progressively enhancing way, to ensure it doesn't
impact on any other functionality. You can find the a demo running here and the completed
28
solution in the realtime commenting repository in github.
29
Good Real-Time App Development Practices
Real-time application development shares common good development practices with general
Web development. However, I thought I would share a couple of tips that can come in
particularly handy.
USE BROWSER DEVELOPER TOOLS
When you start doing a lot of JavaScript development the browser developer tools becomes
your best friend. It's the same when adding realtime functionality to your Web app, not only
because you are using JavaScript, but also because the JavaScript library you are using is
likely to be doing some reasonably complex things internally. So, the best way of
understanding what is going on and if your code is using it as expect is to enable logging
which usually goes to the developer console. All major browser vendors now offer good
developer tools which include a console:
30
Firebug addon for Firefox
Google Chrome Developer Tools 31
Internet Explorer F12 developer tools 32
Opera Dragonfly 33
Safari Developer Tools 34
The Pusher JavaScript library provides a way to hook into the logging functionality. All you
need to do is assign a function to the Pusher.log static property. This function will then
35
receive all log messages. You can do what you like within the function but best practice is to
log the messages to the developer console. You can do this as follow, ensuring the code it
executed after the Pusher JavaScript library include:
 
 
 
 
Search WWH ::




Custom Search