Class: OpenC3::ScriptWebSocketApi

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

Overview

Base class for script-runner-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) ⇒ ScriptWebSocketApi

Returns a new instance of ScriptWebSocketApi.



292
293
294
295
# File 'lib/openc3/script/web_socket_api.rb', line 292

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

Instance Method Details

#generate_urlObject



297
298
299
300
301
302
303
304
# File 'lib/openc3/script/web_socket_api.rb', line 297

def generate_url
  return WebSocketApi.cable_url(
    env_prefix: 'OPENC3_SCRIPT_API',
    default_hostname: 'openc3-cosmos-script-runner-api',
    default_port: '3902',
    path: '/script-api/cable'
  )
end