HTML and CSS Reference
Events are used to further filter data and are ideal for linking updates to
changes in the UI. In this case we want to bind to an event which is triggered whenever a
new comment is added and display it. Because we've already created the
displayComment function we can just pass in a reference to the call to bind .
SENDING REAL-TIME EVENTS USING THE EVENT CREATOR
We can also test out this functionality without writing any server-side code by using the Event
Creator for your app which can also be found in the Pusher dashboard. The Event Creator
lets you publish events on a channel through a simple user interface. From the code above we
can see that we want to publish an event named "new_comment" on the "comments-1"
channel. From the earlier test function we also have an example of the test data we can
Again, we've proven that our client-side functionality works without having to write any
server-side code. Now lets add the PHP code we need to trigger the new comment event as
soon as a comment is posted in our comment system.
Pusher offers a number of server-side libraries which make it easy to publish events in