Last active
December 18, 2015 18:49
-
-
Save mirzu/5828092 to your computer and use it in GitHub Desktop.
images emmiter
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
| setInterval(function newImages() { | |
| // TODO (bonus) - fetch images from flickr or other feeds and refresh the | |
| // client with the fetched content. | |
| images('http://api.flickr.com/services/feeds/photos_public.gne?format=json&tags=badcamp&nojsoncallback=1', function(err, data) { | |
| var newImagesAry = []; | |
| data = JSON.parse(data); | |
| data.items.forEach(function eachItem(item) { | |
| newImagesAry.push({ | |
| picture: item.media.m, | |
| link: item.link | |
| }); | |
| }); | |
| io.sockets.emit('newImages', newImagesAry); | |
| }); | |
| }, config.pollInterval || 10000); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment