Module: Peatio::MQ::Events

Defined in:
lib/peatio/mq/events.rb

Defined Under Namespace

Classes: Client, RangerEvents

Class Method Summary collapse

Class Method Details

.publish(type, id, event, payload) ⇒ Object


9
10
11
12
13
14
15
16
17
18
19
# File 'lib/peatio/mq/events.rb', line 9

def self.publish(type, id, event, payload)
  @@client ||= begin
    ranger = RangerEvents.new
    ranger.connect!
    ranger
  end

  @@client.publish(type, id, event, payload) do
    yield if block_given?
  end
end

.subscribe!Object


4
5
6
7
# File 'lib/peatio/mq/events.rb', line 4

def self.subscribe!
  ranger = RangerEvents.new
  ranger.subscribe
end