Main class to communicate with the networking backend

Implements

  • INetworkConnection

Constructors

Accessors

  • get allowEditing(): boolean
  • True when connected to a room via a regular url, otherwise (when using a view only url) false indicating that the user should not be able to modify the scene

    Returns boolean

  • get connectionId(): string
  • The connection id of the local user - it is given by the networking backend and can not be changed

    Returns string

  • get currentLatency(): number
  • Latency to currently connected backend server

    Returns number

  • get currentRoomName(): string
  • The name of the room the user is currently connected to

    Returns string

  • get currentRoomViewId(): string
  • The view id of the room the user is currently connected to.

    Returns string

  • get currentServerUrl(): string
  • The current server url that the networking backend is connected to (e.g. the url of the websocket server)

    Returns string

  • get isConnected(): boolean
  • True when connected to the networking backend

    Returns boolean

  • get isDebugEnabled(): boolean
  • Returns boolean

  • get isInRoom(): boolean
  • True if connected to a networked room. Use the joinRoom function or a SyncedRoom component

    Returns boolean

Methods

  • Use to start listening to networking events

    Parameters

    Returns Function

  • Use to start listening to networking binary events

    Parameters

    • identifier: string
    • callback: BinaryCallback

    Returns BinaryCallback

  • Used to connect to the networking server

    Returns Promise<boolean>

  • Used to disconnect from the networking server

    Returns void

  • Returns a url that can be shared with others to view the current room in view only mode.
    This is useful for sharing a room with others without allowing them to modify the scene.
    Use connection.allowEditing to check if the current room is in view only mode.

    Returns string

  • Joins a networked room. If you don't want to manage a connection yourself you can use a SyncedRoom component as well

    Parameters

    • room: string
    • viewOnly: boolean = false

    Returns boolean

  • Use to leave a room that you are currently connected to (use leaveRoom() to disconnect from the currently active room but you can also specify a room name)

    Parameters

    • room: string = null

    Returns boolean

  • Use to override the networking server backend url. This is what the Networking component uses to modify the backend url

    Parameters

    • prov: INetworkingWebsocketUrlProvider

    Returns void

  • Send a message to the networking backend - it will broadcasted to all connected users in the same room by default

    Type Parameters

    • T extends WebsocketSendType

    Parameters

    • key: string
    • data: T = null
    • queue: SendQueue = SendQueue.Queued

    Returns void

  • Send a binary message to the server (broadcasted to all connected users)

    Parameters

    Returns void

  • Returns void

  • Use to delete state for a given guid on the server

    Parameters

    • guid: string

    Returns void

  • Use to delete all state in the currently connected room on the server

    Returns void

  • A ping is sent to the server at a regular interval while the browser tab is active. This method can be used to send additional ping messages when needed so that the user doesn't get disconnected from the networking backend

    Returns void

  • Use to stop listening to networking events

    Parameters

    Returns void

  • Use to stop listening to networking binary events

    Parameters

    • identifier: string
    • callback: any

    Returns void

  • Parameters

    Returns void

    Deprecated

    please use stopListen instead (2.65.2-pre)

  • Returns the state of a given guid.

    Parameters

    • guid: string

    Returns IModel

  • Returns true if a user with the given connectionId is in the room

    Parameters

    • id: string

    Returns boolean

  • Returns a list of all user ids in the current room

    Parameters

    • target: string[] = null

    Returns string[]

Generated using TypeDoc