Class: Live::OrderUpdateHub

Inherits:
Object
  • Object
show all
Includes:
Singleton
Defined in:
app/services/live/order_update_hub.rb

Overview

OrderUpdateHub listens for order updates over WebSocket and wires them into local persistence plus downstream execution helpers.

Instance Method Summary collapse

Instance Method Details

#start!Object



13
14
15
16
17
18
19
20
# File 'app/services/live/order_update_hub.rb', line 13

def start!
  return self if @started

  @client = DhanHQ::WS::Orders::Client.new.start
  @client.on(:update) { |msg| handle(msg) }
  @started = true
  self
end

#stop!Object



22
23
24
25
# File 'app/services/live/order_update_hub.rb', line 22

def stop!
  @client&.stop
  @started = false
end