Class: BotMob::Wire
- Inherits:
-
Object
- Object
- BotMob::Wire
- Defined in:
- lib/bot_mob/wire.rb
Overview
## BotMob::Wire
The Wire class is a connection to the Web Server. It receives notifications from authenticated installs over RabbitMQ
Instance Method Summary collapse
Instance Method Details
#connect(app) ⇒ Object
13 14 15 16 17 18 19 |
# File 'lib/bot_mob/wire.rb', line 13 def connect(app) queue.subscribe do |_info, _props, body| app.add_bot(JSON.parse(body)['user_id']) end rescue Bunny::PreconditionFailed => e BotMob.logger.info "#{e.channel_close.reply_code}, message: #{e.channel_close.reply_text}" end |
#publish(message = {}) ⇒ Object
8 9 10 11 |
# File 'lib/bot_mob/wire.rb', line 8 def publish( = {}) BotMob.logger.info "Publishing #{message} to wire.notifications" queue.publish(.to_json, routing_key: queue.name) end |