How to integrate Angular.js with a realtime messaging service like Pusher or PubNub?
Asked Answered
R

5

5

Is it possible to define Pusher or PubNub as an Angular Service? Does someone have code examples of such an integration?

Rimini answered 21/9, 2012 at 10:4 Comment(0)
S
8

Someone already made it :-): http://jsfiddle.net/bv5Kq/13/

Be sure to check out the wiki for examples: https://github.com/angular/angular.js/wiki/JsFiddle-Examples

Skyway answered 21/9, 2012 at 16:8 Comment(1)
In my opinion, using an Angular service that would wrap the PUBNUB code would make more sense than placing the PUBNUB code in a controller. Of course, that could be just example code. Something to keep in mind. More information: docs.angularjs.org/guide/dev_guide.services.creating_servicesBradwell
K
1

There is AngularFire, for working with Firebase - http://angularfire.com/

Key answered 18/9, 2013 at 17:58 Comment(0)
K
1

Try this one. It has color changing, emoticons, clickable hyperlinks and multiple channels. No database or sockets required, just a PubNub account: http://jadendreamer.wordpress.com/2013/10/22/advanced-angular-chatroom-tutorial-no-database-or-sockets-required/

Kaja answered 23/10, 2013 at 17:17 Comment(0)
J
0

There is a somewhat "unofficial" AngularJS library for PubNub. It is a simple service wrapper for the global PUBNUB library object. The main code is in app/scripts/pubnub-angular.coffee and looks like this:

angular.module('pubnub.angular.service', [])
  .factory 'PubNub', () -> PUBNUB

You can find the GitHub repository here:

https://github.com/pubnub/angular-js

Jalapa answered 2/10, 2013 at 18:47 Comment(0)
P
0

Try this: https://disparity.github.io/angular-pusher/, module for integration pusher events into angular event system

Psalmbook answered 10/10, 2015 at 13:28 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.