HTML and CSS Reference
In-Depth Information
Chapter 10
Implementing Realtime Events
and jQuery Effects
At this point, you have a fully functional app. However, in order for this particular app to be useful, it needs to
implement realtime functionality so its users aren't forced to constantly reload to get new data.
In this chapter, you'll hook the app up to Pusher and add code to the back end that will create realtime events.
You'll also use Pusher's JavaScript application programming interface (API) to subscribe to those events and jQuery to
animate the app so the new data can be manipulated onscreen in a non-jarring way.
Which events need realtime enhancement?
Closing a Room
Opening a Room
Asking a Question
Voting a Question
Answering a Question
Adding the Required Credentials and Libraries
Before you can start adding realtime, you'll need to make sure you have all the proper credentials and libraries on
hand to configure the app.
Obtaining Your Pusher API Credentials
The Pusher API requires your app to authenticate using an app key, an app secret, and an app ID.
To obtain them, log in to your account at and select “Add new app” from the top left of your
dashboard. Name your new app “Realtime Web Apps” and leave the two boxes below unchecked (see Figure 10-1 ).
Search WWH ::

Custom Search