Skip to content

Instantly share code, notes, and snippets.

Last active March 10, 2017 19:48
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
PubNub Time Series AI w/ Falkonry UI
<!doctype html>
<script src=""></script>
<script src=""></script>
<script src=""></script>
<script src=""></script>
<link rel="stylesheet" href="//" />
<link rel="stylesheet" href="" />
<div class="container" ng-app="PubNubAngularApp" ng-controller="MyAICtrl">
NOTE: make sure to update the PubNub keys below with your keys,
and ensure that the AI BLOCK is configured properly!
<h3>MyApp IoT Data Feed</h3>
<p>Device ID: <input ng-model="deviceid" /></p>
<p>Device Temp: <input ng-model="devicetemp" /></p>
<p>Device Speed: <input ng-model="devicespeed" /></p>
<p><input type="button" ng-click="publish()" value="Send!" /></p>
<br /><br />
<li ng-repeat="message in messages track by $index">
Device: {{}}
<br />
Temp: {{message.temp}}
<br />
Speed: {{message.speed}}
<br />
angular.module('PubNubAngularApp', ["pubnub.angular.service"])
.controller('MyAICtrl', function($rootScope, $scope, Pubnub) {
$scope.deviceid = parseInt(Math.random() * 10000);
$scope.devicetemp = 20;
$scope.devicespeed = 100;
$scope.messages = [];
$ = 'falkonry-input';
if (!$rootScope.initialized) {
publishKey: 'YOUR_PUB_KEY',
subscribeKey: 'YOUR_SUB_KEY',
$rootScope.initialized = true;
var msgCallback = function(payload) {
$scope.$apply(function() {
$scope.publish = function() {
channel: $,
message: {id:$scope.deviceid, temp:$scope.devicetemp, speed:$scope.devicespeed}
Pubnub.subscribe({ channels: [$] });
Pubnub.addListener({ message: msgCallback });
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment