Live updates

Paweł Pierzchała @zwrozka

Static page


$scope.wallItems = timelineService.all();
          

Polling


function getWallItems() {
   timelineService.all().then(function(items) {
       $scope.wallItems = items;
       $timeout(getWallItems, 1000);
   });
}
          

Live updates


liveTimelineService.onNewItem(...);
          

WebSockets

Two data binding

Angular loop

Angular doesn't know anything about Web Sockets

$rootScope.$apply

Implement live updated list of wall items

Faye::Client

client = new Faye::Client('http://workshop.invaders.co:8000/faye');
client.subscribe('/wall_items', ...);
client.subscribe('/users', ...);