Module: Strelka::WebSocketServer::Heartbeat::ClassMethods
- Defined in:
- lib/strelka/websocketserver/heartbeat.rb
Overview
Class methods to add to servers with a heartbeat.
Instance Method Summary collapse
-
#heartbeat_rate(new_rate = nil) ⇒ Object
Get/set the number of seconds between heartbeat events.
-
#idle_timeout(new_timeout = nil) ⇒ Object
Get/set the number of seconds between events before a client is disconnected.
-
#inherited(subclass) ⇒ Object
Inheritance hook – inheriting classes inherit their parents’ routes table.
Instance Method Details
#heartbeat_rate(new_rate = nil) ⇒ Object
Get/set the number of seconds between heartbeat events.
49 50 51 52 |
# File 'lib/strelka/websocketserver/heartbeat.rb', line 49 def heartbeat_rate( new_rate=nil ) @heartbeat_rate = new_rate.to_f if new_rate return @heartbeat_rate end |
#idle_timeout(new_timeout = nil) ⇒ Object
Get/set the number of seconds between events before a client is disconnected
56 57 58 59 |
# File 'lib/strelka/websocketserver/heartbeat.rb', line 56 def idle_timeout( new_timeout=nil ) @idle_timeout = new_timeout if new_timeout return @idle_timeout end |
#inherited(subclass) ⇒ Object
Inheritance hook – inheriting classes inherit their parents’ routes table.
63 64 65 66 67 |
# File 'lib/strelka/websocketserver/heartbeat.rb', line 63 def inherited( subclass ) super subclass.instance_variable_set( :@idle_timeout, self.idle_timeout.dup ) subclass.instance_variable_set( :@heartbeat_rate, self.heartbeat_rate.dup ) end |