changes for live streaming of posts

This commit is contained in:
barisusakli
2014-03-11 18:46:16 -04:00
parent 1e9850b6b9
commit 813b3d6fcc
7 changed files with 31 additions and 19 deletions

View File

@@ -71,10 +71,7 @@ SocketPosts.reply = function(socket, data, callback) {
posts: [postData]
};
var rooms = ['recent_posts', 'home', 'topic_' + postData.tid, 'user/' + postData.uid];
rooms.forEach(function(room) {
index.server.sockets.in(room).emit('event:new_post', socketData);
});
index.server.sockets.emit('event:new_post', socketData);
callback();
}
@@ -326,4 +323,9 @@ SocketPosts.loadMoreUserPosts = function(socket, data, callback) {
posts.getPostsByUid(socket.uid, data.uid, start, end, callback);
};
SocketPosts.getRecentPosts = function(socket, term, callback) {
posts.getRecentPosts(socket.uid, 0, 19, term, callback);
};
module.exports = SocketPosts;