social-feed

0.1.24 • Public • Published

Social Feed

Aggregates data from multiple social feeds

Configuration

When requiring the module, pass in a configuration object of the following structure

{
    twitter:{
        path:'/1.1/statuses/user_timeline.json?screen_name=screenName',
        clientId:'clientIdclientId',
        clientSecret:'clientSecretclientSecretclientSecret'
    },
    facebook:{
        appID:'appID',
        appSecret:'appSecret',
        path:'/someusername/feed',
        accessToken:'facebookAccessToken'
    },
    youtube:{
        url:'/feeds/api/users/someUser/uploads?v=2&alt=json'
    },
    flickr:{
        consumerKey : 'consumerKey',
        consumerrecret : 'consumerSecret',
        userId : 'userId',
        userKey : 'userKey',
        userSecret : 'userSecret'
    },
    blog:{
        host:'domain.com',
        path:'/feeds/posts/default?alt=json'
    }
}

SocketIO example

On the server...

var io = require('socket.io').listen(3031,{log:false});
var socialFeeds = require('social-feeds')(socialConfigObjectLikeTheAbove);

feed=socialFeeds.getFeeds();
setInterval(function(){
    feed=socialFeeds.getFeeds();
}, 5000);

io.sockets.on('connection', function (socket) {
    socket.on('refreshRequested', function (data) {
        socket.emit('feedUpdate', feed);
    });
    setInterval(function() {
        socket.emit('feedUpdate', feed);
    }, 5000 );
});

And on the client...

<script src="http://127.0.0.1:3031/socket.io/socket.io.js"></script>
<script>
    var socket = io.connect('http://localhost:3031');
    socket.on('feedUpdate', function (data) {
        console.log(data);
    });
</script>

Readme

Keywords

none

Package Sidebar

Install

npm i social-feed

Weekly Downloads

24

Version

0.1.24

License

none

Last publish

Collaborators

  • spnkdev