Class: OpenC3::CmdTlmWebSocketApi

Inherits:
WebSocketApi show all
Defined in:
lib/openc3/script/web_socket_api.rb

Overview

Base class for cmd-tlm-api websockets - Do not use directly

Constant Summary

Constants inherited from WebSocketApi

WebSocketApi::DEFAULT_OPTIONS, WebSocketApi::USER_AGENT

Instance Method Summary collapse

Methods inherited from WebSocketApi

cable_url, #check_protocol_frame, #connect, #connected?, #disconnect, #generate_auth, #parse_message, #read, #read_message, #subscribe, #unsubscribe, #wait_for_subscribed, #write, #write_action, #write_command

Constructor Details

#initialize(url: nil, **options) ⇒ CmdTlmWebSocketApi

Returns a new instance of CmdTlmWebSocketApi.



275
276
277
278
# File 'lib/openc3/script/web_socket_api.rb', line 275

def initialize(url: nil, **options)
  url = generate_url() unless url
  super(url: url, **options)
end

Instance Method Details

#generate_urlObject



280
281
282
283
284
285
286
287
# File 'lib/openc3/script/web_socket_api.rb', line 280

def generate_url
  return WebSocketApi.cable_url(
    env_prefix: 'OPENC3_API',
    default_hostname: 'openc3-cosmos-cmd-tlm-api',
    default_port: '3901',
    path: '/openc3-api/cable'
  )
end