get_users_request + reply ... the array of users is empty for now, I wonder if it will contain users if my user is not the only one in the meeting
This commit is contained in:
parent
28ad6da463
commit
f9ecc5b9a7
@ -31,6 +31,7 @@ config.redis.channels.fromBBBApps = "bigbluebutton:from-bbb-apps:*"
|
||||
config.redis.channels.toBBBApps = {}
|
||||
config.redis.channels.toBBBApps.pattern = "bigbluebutton:to-bbb-apps:*"
|
||||
config.redis.channels.toBBBApps.meeting = "bigbluebutton:to-bbb-apps:meeting"
|
||||
config.redis.channels.toBBBApps.users = "bigbluebutton:to-bbb-apps:users"
|
||||
config.redis.internalChannels = {}
|
||||
config.redis.internalChannels.receive = "html5-receive"
|
||||
config.redis.internalChannels.reply = "html5-reply"
|
||||
|
@ -20,7 +20,7 @@ module.exports = class ClientProxy
|
||||
@io.sockets.on 'connection', (socket) =>
|
||||
log.debug({ client: socket.id }, "Client has connected.")
|
||||
socket.on 'message', (jsonMsg) =>
|
||||
log.debug({ message: jsonMsg }, "Received message")
|
||||
log.debug({ message: jsonMsg }, "Received message") # TODO to check whether only 'message' works or 'djhkwa' too
|
||||
@_handleMessage(socket, jsonMsg)
|
||||
socket.on 'disconnect', =>
|
||||
@_handleClientDisconnected socket
|
||||
@ -62,6 +62,8 @@ module.exports = class ClientProxy
|
||||
switch message.header.name
|
||||
when 'validate_auth_token'
|
||||
@_handleLoginMessage socket, message
|
||||
when 'get_users_reply'
|
||||
sendMessageToClient socket, message
|
||||
else
|
||||
log.error({ message: message }, 'Unknown message name.')
|
||||
|
||||
@ -77,7 +79,6 @@ module.exports = class ClientProxy
|
||||
socket.join(result.payload.user_id)
|
||||
socket.join(result.payload.meeting_id)
|
||||
|
||||
socket.emit("UserJoined", result.payload.user_id)
|
||||
# assign the userId to this socket. This way we can
|
||||
# locate this socket using the userId.
|
||||
socket.userId = result?.payload?.user_id
|
||||
|
@ -20,18 +20,16 @@ module.exports = class Controller
|
||||
processAuthMessage: (data, callback) ->
|
||||
log.info({ data: data }, "Sending an authentication request and waiting for reply")
|
||||
@messageBus.sendAndWaitForReply data, (err, result) ->
|
||||
console.log "\n I am waiting for a reply"
|
||||
if err?
|
||||
log.error({ reason: err, result: result, original: data }, "Authentication failure")
|
||||
callback(err, null)
|
||||
else
|
||||
if result.payload?.valid
|
||||
if result.payload?.valid #is 'true'
|
||||
log.info({ result: result }, "Authentication successful")
|
||||
callback(null, result)
|
||||
else
|
||||
log.info({ result: result }, "Authentication failure")
|
||||
callback(new Error("Authentication failure"), null)
|
||||
console.log "\n I am no longer waiting for a reply"
|
||||
|
||||
# processEndMessage: (data, callback) ->
|
||||
# @clientProxy.endMeeting()
|
||||
|
@ -58,7 +58,7 @@ module.exports = class RedisPubSub
|
||||
# put the entry in the hash so we can match the response later
|
||||
@pendingRequests[correlationId] = entry
|
||||
message.header.reply_to = correlationId
|
||||
console.log("\n\n\n\n\nmessage=" + JSON.stringify(message) + "\n\n\n")
|
||||
console.log("\n\nmessage=" + JSON.stringify(message) + "\n\n")
|
||||
log.info({ message: message, channel: config.redis.channels.toBBBApps.meeting}, "Publishing a message")
|
||||
@pubClient.publish(config.redis.channels.toBBBApps.meeting, JSON.stringify(message))
|
||||
|
||||
@ -75,7 +75,7 @@ module.exports = class RedisPubSub
|
||||
message = JSON.parse(jsonMsg)
|
||||
unless message.header?.name is "keep_alive_reply" #temporarily stop logging the keep_alive_reply message
|
||||
log.debug({ pattern: pattern, channel: channel, message: message}, "Received a message from redis")
|
||||
console.log "=="+message.header?.name
|
||||
console.log "=="+JSON.stringify message
|
||||
|
||||
# retrieve the request entry
|
||||
|
||||
@ -95,6 +95,29 @@ module.exports = class RedisPubSub
|
||||
else
|
||||
sendToController(message)
|
||||
|
||||
if message.header?.name is 'validate_auth_token_reply'
|
||||
if message.payload?.valid is "true"
|
||||
|
||||
getUsersMessage = {
|
||||
"payload": {
|
||||
"meeting_id": message.payload.meeting_id
|
||||
"requester_id": message.payload.userid
|
||||
},
|
||||
"header": {
|
||||
"timestamp": new Date().getTime(),
|
||||
"reply_to": message.payload.meeting_id + "/" + message.payload.userid
|
||||
"name": "get_users_request"
|
||||
}
|
||||
}
|
||||
|
||||
@pubClient.publish(config.redis.channels.toBBBApps.users, JSON.stringify(getUsersMessage))
|
||||
console.log "just published the getUsersMessage from RedisPubSub"
|
||||
|
||||
if message.header?.name is 'get_users_reply'
|
||||
console.log 'got a reply from bbb-apps: ' + JSON.stringify message
|
||||
|
||||
sendToController(message)
|
||||
|
||||
sendToController = (message) ->
|
||||
postal.publish
|
||||
channel: config.redis.internalChannels.receive
|
||||
|
@ -80,10 +80,12 @@ define [
|
||||
}
|
||||
}
|
||||
|
||||
validFields = @authToken? and @userId? and @meetingId?
|
||||
#emit the validate_auth_token json message if the fields have been populated
|
||||
if @authToken? and @userId? and @meetingId?
|
||||
@socket.emit "message", message
|
||||
|
||||
#emit the validate token json message
|
||||
@socket.emit "message", message if validFields
|
||||
@socket.on "get_users_reply", (message) =>
|
||||
alert 'will now populate some users' + JSON.stringify message
|
||||
|
||||
# Received event to logout yourself
|
||||
@socket.on "logout", ->
|
||||
|
Loading…
Reference in New Issue
Block a user