bigbluebutton-Github/client/bbb-html5-client/lib/controller.coffee

24 lines
705 B
CoffeeScript
Raw Normal View History

2014-04-14 07:39:18 +08:00
bus = require './messagebus'
2014-04-14 08:16:37 +08:00
log = require './bbblogger'
2014-04-14 07:39:18 +08:00
2014-04-14 22:58:20 +08:00
messageReceiver = null
exports.registerMessageReceiver = (callback) ->
messageReceiver = callback
2014-04-14 08:16:37 +08:00
exports.processLoginMessage = (data, callback) ->
bus.sendMessage(data, (err, result) ->
if (err)
2014-04-14 10:18:21 +08:00
errLog = {reason: err, data: data}
log.error({error: errLog}, 'Authentication Failure')
2014-04-14 08:16:37 +08:00
callback(err, null)
else
2014-04-14 10:18:21 +08:00
log.info("SUCCESS: #{result}")
2014-04-14 08:16:37 +08:00
if result.error?
2014-04-14 10:18:21 +08:00
log.info({error: result.error}, 'Authentication Failure')
2014-04-14 08:16:37 +08:00
callback(result.error, null)
2014-04-14 07:39:18 +08:00
else
2014-04-14 10:18:21 +08:00
log.info({response: result.data}, 'Authentication Success')
2014-04-14 08:16:37 +08:00
callback(null, result.data)
)