bigbluebutton-Github/client/bbb-html5-client/lib/controller.coffee
2014-04-14 07:58:20 -07:00

24 lines
705 B
CoffeeScript
Executable File

bus = require './messagebus'
log = require './bbblogger'
messageReceiver = null
exports.registerMessageReceiver = (callback) ->
messageReceiver = callback
exports.processLoginMessage = (data, callback) ->
bus.sendMessage(data, (err, result) ->
if (err)
errLog = {reason: err, data: data}
log.error({error: errLog}, 'Authentication Failure')
callback(err, null)
else
log.info("SUCCESS: #{result}")
if result.error?
log.info({error: result.error}, 'Authentication Failure')
callback(result.error, null)
else
log.info({response: result.data}, 'Authentication Success')
callback(null, result.data)
)