Class: Cybertrain::WebSocket::Status

Inherits:
Object
  • Object
show all
Defined in:
cybertrain/websocket.rb

Overview

A snapshot of a subscription’s state, from feed_status.

Instance Method Summary collapse

Instance Method Details

#connected? ⇒ Boolean

Returns whether the feed is connected now.

Returns:

  • (Boolean) —

    whether the feed is connected now



131
132
133
# File 'cybertrain/websocket.rb', line 131

def connected?
  @connected
end

#last_message_at ⇒ Integer

Returns epoch seconds of the last message, 0 for none yet.

Returns:

  • (Integer) —

    epoch seconds of the last message, 0 for none yet



137
138
139
# File 'cybertrain/websocket.rb', line 137

def last_message_at
  @last_message_at
end

#reconnects ⇒ Integer

Returns how many times the feed connected again after its first connection.

Returns:

  • (Integer) —

    how many times the feed connected again after its first connection



144
145
146
# File 'cybertrain/websocket.rb', line 144

def reconnects
  @reconnects
end

#restarts ⇒ Integer

Returns how many times the supervisor started the feed’s thread again after it ended.

Returns:

  • (Integer) —

    how many times the supervisor started the feed’s thread again after it ended



151
152
153
# File 'cybertrain/websocket.rb', line 151

def restarts
  @restarts
end

#thread_alive? ⇒ Boolean

Returns whether the feed’s thread is running (false before Cybertrain::WebSocket.start!, after Cybertrain::WebSocket.stop!, and between the thread’s death and its restart).

Returns:



159
160
161
# File 'cybertrain/websocket.rb', line 159

def thread_alive?
  @thread_alive
end