Options
All
  • Public
  • Public/Protected
  • All
Menu

Class SpectrumLobby

Used internal to represent a spectrum text lobby

class

SpectrumLobby

Hierarchy

  • SpectrumLobby

Index

Constructors

constructor

Properties

Private _community

_community: any

used internally to store the rsi community info

Private _lobby

_lobby: Lobby | any

used internally to store the rsi lobby info

Private _messageListener

_messageListener: number

Our message listener

Private broadcaster

broadcaster: Broadcaster = Broadcaster.getInstance()

instance of RSI Spectrum ws

Private rsi

rsi: RSI = RSI.getInstance()

instance of RSI api

Methods

OnTextMessage

  • OnTextMessage(callback?: (Anonymous function)): void
  • Sets a function to be called everytime a new TextMessage is received in this lobby. /!\ to receive any messages you need to be subscribed to this lobby

    see

    subscribe()

    todo

    have more than one callback

    Parameters

    • Default value callback: (Anonymous function) = (message: receivedTextMessage) => { }

      the function to callback on messages

    Returns void

buildSubscribtionMessage

  • buildSubscribtionMessage(): object
  • Builds and return the expected subscribtion ws message for this channel

    Returns object

    the message that can be sent to the ws to subscribe to this channel

    • subscription_keys: any[]
    • subscription_scope: string
    • type: string

closeOnTextMessage

  • closeOnTextMessage(): void

Private doPostMessage

editPlainTextMessage

  • editPlainTextMessage(messageId: number, text: string): Promise<any>

Private generateTextPayload

  • generateTextPayload(text: any, mediaId?: any, highlightId?: any): object
  • Parameters

    • text: any
    • Default value mediaId: any = null
    • Default value highlightId: any = null

    Returns object

    • content_state: object
      • blocks: any[]
      • entityMap: any
    • highlight_role_id: any
    • lobby_id: any
    • media_id: any
    • plaintext: any

getCommunity

  • getCommunity(): void

getHistory

  • getHistory(): void

getLobby

getMessages

  • getMessages(): void

getPresence

  • getPresence(): void

isSubscribed

  • isSubscribed(): boolean

sendPlainTextMessage

sendTextMessageWithEmbed

  • sendTextMessageWithEmbed(text: string, embedUrl: string, highlight_role_id?: any): Promise<SpectrumTextMessage>
  • Sends a text messages with an embeded link

    Parameters

    • text: string

      the text to send

    • embedUrl: string
    • Default value highlight_role_id: any = null

      the role id to take (color of the post)

    Returns Promise<SpectrumTextMessage>

    information on the created post

subscribe

  • subscribe(): void
  • Subscribe a lobby will subscribe to its ws event and broadcast presence It is needed to subscribe to a channel to get any update from it (new message/reaction...)

    Returns void

unSubscribe

  • unSubscribe(): void

Generated using TypeDoc