5d1fb4c168
The client sends a 'validate_auth_token_request' to the server, that waits a 'validate_auth_token_reply' response from bbb-apps to pass to the client. Still have to get info from /api/enter, for now the meetingId and userId are hard-coded in the client (AuthenticationModel).
41 lines
1.0 KiB
CoffeeScript
Executable File
41 lines
1.0 KiB
CoffeeScript
Executable File
postal = require('postal')
|
|
crypto = require 'crypto'
|
|
|
|
config = require '../config'
|
|
log = require './bbblogger'
|
|
|
|
moduleDeps = ["RedisPubSub"]
|
|
|
|
module.exports = class MessageBus
|
|
|
|
constructor: ->
|
|
config.modules.wait moduleDeps, =>
|
|
@pubSub = config.modules.get("RedisPubSub")
|
|
|
|
receiveMessages: (callback) ->
|
|
postal.subscribe
|
|
channel: config.redis.internalChannels.receive
|
|
topic: "broadcast"
|
|
callback: (msg, envelope) ->
|
|
callback(msg)
|
|
|
|
sendAndWaitForReply: (data, callback) ->
|
|
replyTo =
|
|
channel: config.redis.internalChannels.reply
|
|
topic: 'get.' + crypto.randomBytes(16).toString('hex')
|
|
|
|
postal.subscribe(
|
|
channel: replyTo.channel
|
|
topic: replyTo.topic
|
|
callback: (msg, envelope) ->
|
|
callback(null, msg)
|
|
).once()
|
|
|
|
log.info({ message: data, replyTo: replyTo }, "Sending a message and waiting for reply")
|
|
|
|
postal.publish
|
|
channel: config.redis.internalChannels.publish
|
|
topic: 'broadcast'
|
|
replyTo: replyTo
|
|
data: data
|