-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Support subscribing to array of pubnub channels - Add support for channel groups (fix #5) - under_score to camelCase to match PubNub JS SDK v4 - Add new channel_groups example - Document bower, npm, and github pages hotlinking (fix #7) - Fix demos up
- Loading branch information
1 parent
4d5b43e
commit c747a3b
Showing
21 changed files
with
417 additions
and
207 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
<html> | ||
<head> | ||
<link rel="stylesheet" type="text/css" href="../bower_components/c3/c3.min.css"> | ||
<script src="../bower_components/pubnub/dist/web/pubnub.min.js"></script> | ||
<script src="../bower_components/d3/d3.min.js"></script> | ||
<script src="../bower_components/c3/c3.min.js"></script> | ||
<script src="../bower_components/visibilityjs/lib/visibility.core.js"></script> | ||
|
||
<script src="../pubnub-c3.js"></script> | ||
|
||
</head> | ||
<body> | ||
<div id="chart"></div> | ||
<script> | ||
|
||
var pubnub = new PubNub({ | ||
publishKey: 'pub-c-6dbe7bfd-6408-430a-add4-85cdfe856b47', | ||
subscribeKey: 'sub-c-2a73818c-d2d3-11e3-9244-02ee2ddab7fe' | ||
}); | ||
|
||
var channels = ['pubnub-c3-1', 'pubnub-c3-2', 'pubnub-c3-3']; | ||
|
||
// create channel group | ||
pubnub.channelGroups.addChannels( | ||
{ | ||
channels: channels, | ||
channelGroup: "pubnub-c3-example" | ||
}, | ||
function(status) { | ||
if (status.error) { | ||
console.log("operation failed w/ status: ", status); | ||
} else { | ||
console.log("operation done!") | ||
|
||
// list channels | ||
pubnub.channelGroups.listChannels( | ||
{ | ||
channelGroup: "pubnub-c3-example" | ||
}, | ||
function (status, response) { | ||
if (status.error) { | ||
console.log("operation failed w/ error:", status); | ||
return; | ||
} | ||
|
||
console.log("listing push channel for device") | ||
response.channels.forEach( function (channel) { | ||
console.log(channel) | ||
}) | ||
} | ||
); | ||
|
||
} | ||
} | ||
); | ||
|
||
|
||
eon.chart({ | ||
channelGroups: ['pubnub-c3-example'], | ||
history: true, | ||
flow: true, | ||
pubnub: pubnub, | ||
connect: connect, | ||
generate: { | ||
bindto: '#chart', | ||
data: { | ||
type: 'spline', | ||
labels: false | ||
} | ||
} | ||
}); | ||
|
||
function publish(pointId, channel) { | ||
|
||
var m = { | ||
eon:{} | ||
}; | ||
m.eon[pointId] = Math.floor(Math.random() * 99); | ||
|
||
pubnub.publish({ | ||
channel: channel, | ||
message: m | ||
}); | ||
|
||
} | ||
|
||
function connect() { | ||
|
||
console.log('connect') | ||
|
||
setInterval(function(){ | ||
publish('first', channels[0]); | ||
publish('second', channels[1]); | ||
publish('third', channels[2]); | ||
}, 1000); | ||
|
||
}; | ||
</script> | ||
</body> | ||
</html> |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.