Class: MonitorConnection
- Inherits:
-
EventMachine::WebSocket::Connection
- Object
- EventMachine::WebSocket::Connection
- MonitorConnection
- Defined in:
- lib/monitorer.rb
Instance Method Summary collapse
-
#initialize(service) ⇒ MonitorConnection
constructor
A new instance of MonitorConnection.
- #trigger_on_close(event = {}) ⇒ Object
- #trigger_on_open(handshake) ⇒ Object
Constructor Details
#initialize(service) ⇒ MonitorConnection
Returns a new instance of MonitorConnection.
2 3 4 |
# File 'lib/monitorer.rb', line 2 def initialize(service) @service = service end |
Instance Method Details
#trigger_on_close(event = {}) ⇒ Object
10 11 12 |
# File 'lib/monitorer.rb', line 10 def trigger_on_close(event = {}) @service.channel.unsubscribe @id end |
#trigger_on_open(handshake) ⇒ Object
6 7 8 |
# File 'lib/monitorer.rb', line 6 def trigger_on_open(handshake) @id = @service.channel.subscribe &method(:post_event) end |