-
-
Save StanShumsky/f4837c89cdf1e17373b5 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$scope.subscribe = function() { | |
... | |
PubNub.ngSubscribe({ | |
channel: theChannel, | |
state: { | |
"firstName" : $scope.user.firstName, | |
"lastName" : $scope.user.lastName, | |
"favoriteColor" : $scope.user.faveColor | |
} | |
}); | |
... | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
PubNub.ngState({ | |
channel:theChannel, | |
state: { | |
"firstName":$scope.user.firstName, | |
"lastName":$scope.user.lastName, | |
"lat":$scope.user.position.lat, | |
"lon":$scope.user.position.lon | |
} | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
PubNub.ngSubscribe({ channel: theChannel }); | |
... | |
$rootScope.$on(PubNub.ngPrsEv(theChannel), function(event, payload) { | |
// event is AngularJS event, payload contains PubNub Presence event | |
console.log('got a presence event:', payload); | |
}); | |
... | |
PubNub.ngHereNow({ channel: theChannel }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
PubNub.ngSubscribe({ channel: theChannel }); | |
PubNub.ngHereNow({ channel: theChannel }); | |
... | |
allTheUsers = PubNub.ngListPresence(theChannel); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
PubNub.ngSubscribe({ channel: theChannel }); | |
PubNub.ngHereNow({ channel: theChannel }); | |
... | |
$rootScope.$on(PubNub.ngPrsEv(theChannel), function(event, payload) { | |
$scope.userList = PubNub.ngListPresence(theChannel); | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
PubNub.ngSubscribe({ channel: theChannel }); | |
PubNub.ngHereNow({ channel: theChannel }); | |
... | |
$rootScope.$on(PubNub.ngPrsEv(theChannel), function(event, payload) { | |
$scope.userDataMap = PubNub.ngPresenceData(theChannel); | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
PubNub.ngWhereNow({ | |
uuid:theUserId, | |
callback:function(){console.log(arguments)} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment