Class: OpenC3::CmdTlmWebSocketApi
- Inherits:
-
WebSocketApi
- Object
- WebSocketApi
- OpenC3::CmdTlmWebSocketApi
- Defined in:
- lib/openc3/script/web_socket_api.rb
Overview
Base class for cmd-tlm-api websockets - Do not use directly
Direct Known Subclasses
AutonomicEventsWebSocketApi, CalendarEventsWebSocketApi, ConfigEventsWebSocketApi, LimitsEventsWebSocketApi, MessagesWebSocketApi, StreamingWebSocketApi, SystemEventsWebSocketApi, TimelineEventsWebSocketApi
Constant Summary
Constants inherited from WebSocketApi
Instance Method Summary collapse
- #generate_url ⇒ Object
-
#initialize(url: nil, write_timeout: 10.0, read_timeout: 10.0, connect_timeout: 5.0, authentication: nil, scope: $openc3_scope) ⇒ CmdTlmWebSocketApi
constructor
A new instance of CmdTlmWebSocketApi.
Methods inherited from WebSocketApi
#connect, #connected?, #disconnect, #generate_auth, #read, #read_message, #subscribe, #unsubscribe, #write, #write_action
Constructor Details
#initialize(url: nil, write_timeout: 10.0, read_timeout: 10.0, connect_timeout: 5.0, authentication: nil, scope: $openc3_scope) ⇒ CmdTlmWebSocketApi
Returns a new instance of CmdTlmWebSocketApi.
177 178 179 180 |
# File 'lib/openc3/script/web_socket_api.rb', line 177 def initialize(url: nil, write_timeout: 10.0, read_timeout: 10.0, connect_timeout: 5.0, authentication: nil, scope: $openc3_scope) url = generate_url() unless url super(url: url, write_timeout: write_timeout, read_timeout: read_timeout, connect_timeout: connect_timeout, authentication: authentication, scope: scope) end |
Instance Method Details
#generate_url ⇒ Object
182 183 184 185 186 187 188 |
# File 'lib/openc3/script/web_socket_api.rb', line 182 def generate_url schema = ENV['OPENC3_API_SCHEMA'] || 'http' hostname = ENV['OPENC3_API_HOSTNAME'] || (ENV['OPENC3_DEVEL'] ? '127.0.0.1' : 'openc3-cosmos-cmd-tlm-api') port = ENV['OPENC3_API_PORT'] || '2901' port = port.to_i return "#{schema}://#{hostname}:#{port}/openc3-api/cable" end |