Changes
This commit is contained in:
commit
d9eb0c8cf2
@ -21,6 +21,10 @@ Meteor.methods
|
||||
#{Meteor.Chat.find({meetingId: meetingId}).count()}"
|
||||
|
||||
sendChatMessagetoServer: (meetingId, messageObject) ->
|
||||
|
||||
#Meteor.redisPubSub.publishChatMessage(meetingId, messageObject)
|
||||
#console.log Meteor.redisPubSub
|
||||
Meteor.call "addChatToCollection", meetingId, messageObject
|
||||
# Meteor.call "addChatToCollection", meetingId, messageObject
|
||||
|
||||
# Meteor.call "publishChatMessage", meetingId, messageObject
|
||||
|
||||
|
@ -59,11 +59,9 @@ Meteor.methods
|
||||
console.log "added user id=[#{id}]:#{user.name}. Users.size is now #{Meteor.Users.find({meetingId: meetingId}).count()}"
|
||||
|
||||
removeUserFromCollection: (meetingId, userId) ->
|
||||
console.log "----removing " + userId + "from " + meetingId
|
||||
if meetingId? and userId?
|
||||
if meetingId? and userId? and Meteor.Users.findOne({meetingId: meetingId, userId: userId})?
|
||||
console.log "----removing " + userId + "from " + meetingId
|
||||
console.log "before:" + Meteor.Users.find().count()
|
||||
id = Meteor.Users.findOne({meetingId: meetingId, userId: userId})
|
||||
Meteor.Users.remove(_id: id._id)
|
||||
Meteor.Users.remove(id._id)
|
||||
console.log "after:" + Meteor.Users.find().count()
|
||||
else
|
||||
console.log "at least one of {userId, meetingId} was missing"
|
||||
|
@ -10,6 +10,9 @@ Meteor.methods
|
||||
#dispatch a message to redis
|
||||
Meteor.redisPubSub.sendUserLeavingRequest(meetingId, userId)
|
||||
|
||||
publishChatMessage: (meetingId, messageObject) ->
|
||||
Meteor.redisPubSub.publishingChatMessage(meetingId, messageObject)
|
||||
|
||||
|
||||
class Meteor.RedisPubSub
|
||||
constructor: (callback) ->
|
||||
@ -62,7 +65,7 @@ class Meteor.RedisPubSub
|
||||
}
|
||||
}
|
||||
if userId? and meetingId?
|
||||
@pubClient.publish(Meteor.config.redis.channels.toBBBApps.meeting, JSON.stringify(message))
|
||||
@pubClient.publish(Meteor.config.redis.channels.toBBBApps.users, JSON.stringify(message))
|
||||
else
|
||||
console.log "did not have enough information to send a user_leaving_request"
|
||||
|
||||
@ -132,7 +135,7 @@ class Meteor.RedisPubSub
|
||||
console.log "res=" + res
|
||||
)
|
||||
|
||||
publishChatMessage: (meetingId, chatObject) =>
|
||||
publishingChatMessage: (meetingId, chatObject) =>
|
||||
console.log "publishing a chat message to bbb-apps"
|
||||
message = {
|
||||
header : {
|
||||
@ -145,5 +148,5 @@ class Meteor.RedisPubSub
|
||||
"requester_id": chatObject.from_userid
|
||||
}
|
||||
}
|
||||
console.log "\n\n\n\n" + JSON.stringify (message)
|
||||
console.log "publishing:" + JSON.stringify (message)
|
||||
@pubClient.publish(Meteor.config.redis.channels.toBBBApps.chat, JSON.stringify (message))
|
||||
|
@ -29,6 +29,7 @@ Meteor.startup ->
|
||||
Meteor.Users.remove({})
|
||||
console.log "cleared Users Collection!"
|
||||
Meteor.Chat.remove({})
|
||||
console.log "cleared Chat Collection!"
|
||||
|
||||
# create create a PubSub connection, start listening
|
||||
Meteor.redisPubSub = new Meteor.RedisPubSub(->
|
||||
|
Loading…
Reference in New Issue
Block a user