Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to properly wrap GAE Channel API in Angular.js service and push updates out to the entire app?

So I'm trying to use the GAE Channel API with Angular.js to do real-time data-bound updates (which would be really cool, right!?). I'm told the correct way to do this is to wrap the Channel API Javascript Client in an Angular.js service (and make sure to use $apply()). But what does that mean exactly?

To my understanding, for the Channel API, I'm pretty much supposed to have a 1:1 client:channel connection, so all my updates will have to flow down that one channel for all the models in my entire app. How do I then broadcast to possibly multiple scopes that a model (generally an ngResource) has been updated? $watch? $emit? $broadcast? $digest?

like image 366
SteveShaffer Avatar asked Dec 04 '25 12:12

SteveShaffer


1 Answers

I had the same requirement and solved it with an Angular service. I described my solution here :

http://david-codes.blogspot.com/2013/03/app-engine-channel-api-and-angular-js.html

like image 57
David Avatar answered Dec 06 '25 02:12

David



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!