Live updates



Live updates

0 1


angular-workshop-live-updates

Slides for live updates presentation

On Github wrozka / angular-workshop-live-updates

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 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', ...);