Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Connection

An RTEnnui connection, including all requisite server and peer connections. Everything to do with the outgoing stream is also implemented here, because there's only one outgoing stream (with any number of tracks) per connection.

Events:

  • connected(null): Connection has successfully been established.
  • disconnected(CloseEvent): The connection has been closed.
  • peer-joined({id: number, info: any}): A peer has joined.
  • peer-left({id: number, info: any}): A peer has left.
  • peer-p2p-connected({peer: number}): We've established a P2P connection with this peer.
  • peer-p2p-disconnected({peer: number}): We've lost our P2P connection with this peer.
  • peer-p2p-latency({peer: number, network: number, buffer: number, total: number}): Reports the expected latency in receiving audio from this peer, in ms, in several components.
  • stream-started({peer: number}): A new stream from this peer has started.
  • stream-ended({peer: number}): This peer's stream has ended.
  • track-started-video({peer: number, id: number, element: HTMLElement}): Video track started.
  • track-started-audio({peer: number, id: number, node: AudioNode): Audio track started.
  • track-ended-video({peer: number, id: number, element: HTMLElement}): Video track ended.
  • track-ended-audio({peer: number, id: number, node: AudioNode}): Audio track ended.

Hierarchy

  • AbstractRoom
    • Connection

Index

Constructors

constructor

  • Parameters

    • _ac: AudioContext

    Returns Connection

Methods

_getOwnId

  • _getOwnId(): number
  • Returns number

_sendServer

  • _sendServer(msg: ArrayBuffer): void
  • Parameters

    • msg: ArrayBuffer

    Returns void

addAudioTrack

addVideoTrack

  • Add an outgoing video track.

    Parameters

    Returns Promise<void>

connect

  • connect(url: string, credentials: any): Promise<boolean>
  • Connect to the RTEnnui server. Returns true if the connection was successful. Do not use if this Connection is already connected or has otherwise been used; make a new one.

    Parameters

    • url: string

      Server address.

    • credentials: any

      Login credentials.

    Returns Promise<boolean>

emitEvent

  • emitEvent(ev: string, arg: any): void
  • Emit this event.

    Parameters

    • ev: string

      Event name to emit.

    • arg: any

      Argument to the event handler(s).

    Returns void

off

  • Remove an event handler.

    Parameters

    • ev: string

      Event name.

    • handler: EventHandler

      Handler to remove.

    Returns void

on

  • Set an event handler.

    Parameters

    • ev: string

      Event name, or "*" for all events.

    • handler: EventHandler

      Event handler for this event.

    Returns void

once

  • Set a one-time event handler.

    Parameters

    • ev: string

      Event name, or "*" for all events.

    • handler: EventHandler

      Event handler for this event.

    Returns void

Generated using TypeDoc