Options
All
  • Public
  • Public/Protected
  • All
Menu

Index

Type aliases

CompressionMethod: "none" | "cs:gzip" | "cs:deflate"

Functions

  • connect(id: string): void
  • disconnectFromAllPeers(): void
  • forceUseRelayServer(shouldUseRelayServer: boolean): void
  • Forces the usage of a relay (TURN) server, to avoid sharing IP addresses with the other peers.

    Parameters

    • shouldUseRelayServer: boolean

      Whether relay-only should be enabled or disabled.

    Returns void

  • getAllPeers(): string[]
  • getCurrentId(): string
  • getJustDisconnectedPeers(): string[]
  • isReady(): boolean
  • sendDataTo(ids: string[], messageName: string, messageData: object): Promise<void>
  • Send a message to a specific peer.

    Parameters

    • ids: string[]

      The IDs of the clients to send the event to.

    • messageName: string

      The event to trigger.

    • messageData: object

    Returns Promise<void>

  • useCustomBrokerServer(host: string, port: number, path: string, key: string, ssl: boolean): void
  • Connects to a custom broker server.

    Parameters

    • host: string

      The host of the broker server.

    • port: number

      The port of the broker server.

    • path: string

      The path (part of the url after the host) to the broker server.

    • key: string

      Optional password to connect to the broker server.

    • ssl: boolean

      Use ssl?

    Returns void

  • useCustomICECandidate(urls: string, username?: string, credential?: string): void
  • Adds an ICE server candidate, and removes the default ones provided by PeerJs. Must be called before connecting to a broker.

    Parameters

    • urls: string

      The URL of the STUN/TURN server.

    • Optional username: string

      An optional username to send to the server.

    • Optional credential: string

      An optional password to send to the server.

    Returns void

  • useDefaultBrokerServer(): void

Generated using TypeDoc