Search code examples
angularjswebsocketrestangular

Using web Socket Angularjs to show alerts total number


I have API to return alerts total number. I would like to using web socket (real time) to show this number in header (number > 0 - the same Facebook notification). I am using Restangular to call API. Help me about demo to using it. Thanks.


Solution

  • maybe u should use socket.io

    http://socket.io/get-started/chat/

    then yo cna use this wrapper

    https://github.com/btford/angular-socket-io

    you should "build" own socket io whic will push new event to you app and inside angular you just "listen to this event"

    io.on('notification', function(data) {
      $scope.notifications = data;
    })