Class: Radiowaves::Transmitter
- Inherits:
-
Object
- Object
- Radiowaves::Transmitter
- Includes:
- Logging
- Defined in:
- lib/radiowaves/transmitter.rb
Instance Method Summary collapse
-
#initialize(host, port) ⇒ Transmitter
constructor
A new instance of Transmitter.
- #start ⇒ Object
Methods included from Logging
Constructor Details
#initialize(host, port) ⇒ Transmitter
Returns a new instance of Transmitter.
8 9 10 |
# File 'lib/radiowaves/transmitter.rb', line 8 def initialize(host, port) @client = WebSocket.new("ws://#{host}:#{port}/") end |
Instance Method Details
#start ⇒ Object
12 13 14 15 16 17 18 19 |
# File 'lib/radiowaves/transmitter.rb', line 12 def start ActiveSupport::Notifications.subscribe do |*args| event = ActiveSupport::Notifications::Event.new(*args) json_event = event.to_json logger.debug json_event @client.send json_event end end |