Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Service

Main API Class for Spectrum BOT Performs every spectrum user actions via wss or api calls

class

Spectrum

Hierarchy

  • Service

Index

Constructors

constructor

  • new Service(callback?: any, errorCallback?: any): Service

Properties

Private _payload

_payload: Identify

backup payload

Private clientId

clientId: any

clientId used as x-tavern-id for some calls

Private dropAuthTTL

dropAuthTTL: number = 2

amount of reconnect (on ws drop) before identify again

Private reconnectTTL

reconnectTTL: number = 10

amount of reconnect (on connection loss) tries we still have

Private rsi

rsi: RSI = RSI.getInstance()

the RSI API instance

Private spectrumUrl

spectrumUrl: string = "wss://robertsspaceindustries.com/ws/spectrum"

main wss endpoint

Private state

state: State = null

state of the system

Private wss

wss: WebSocketClient = new wssClient()

Wss Client for spectrum

wssCo

wssCo: WebSocketConnection

Wss Connection for spectrum

Methods

LookForUserByName

  • LookForUserByName(monickerOrHandle: string): Promise<SpectrumUser[]>
  • Calls the RSI API to search the given name and tries to come up with the best match possibles. will not return the BOT's own identity

    Parameters

    • monickerOrHandle: string

      the text to search by

    Returns Promise<SpectrumUser[]>

    an array of Users sorted by best likelyhood as calculated by RSI

getState

Private getTavernId

  • getTavernId(token: any): void

Private identify

initAsUser

  • initAsUser(username: any, password: any): Promise<boolean>
  • Convenience method for initSpectrum() Launch spectrum as a given user with password

    see

    initSpectrum()

    Parameters

    • username: any

      the username

    • password: any

      the password

    Returns Promise<boolean>

    a promise which is true when the connection is ready

initSpectrum

  • initSpectrum(): Promise<boolean>
  • initSpectrum(username: any, password: any): Promise<boolean>

Private initWs

launchWS

  • launchWS(): boolean

Private loginRsi

  • loginRsi(): Promise<any>

resetTTLs

  • resetTTLs(): void

Private wssConnecFailed

  • wssConnecFailed(error: any): void

Private wssConnected

  • wssConnected(connection: any): void

Generated using TypeDoc