Utility class for handling the management of all connected network components. Each component, that should be send or updated over the network, needs to be registered via the NetworkManager.registerNetworkedComponent method. If the component is destroyed or not used anymore, for example a player, who left the server, you should call the NetworkManager.removeObject method.

Hierarchy

  • NetworkManager

Constructors

Properties

lastMessageTimestamp: number = 0
numberOfAcceptedData: number = 0
numberOfReceivedData: number = 0
onEvent: Emitter<[WonderlandWebsocketEvent]> = ...
readComponents: Map<any, any> = ...
writeComponents: Map<any, any> = ...

Methods

  • Internal method to update the reading components, by iteration over the received data array and taking the newest data chunk, then updating each readComponent which matches the network id with it's current transforms

    Returns void

  • Internal method to update the sending components, by iteration over the write components array, packaging all objects with their networkIds, and then adding each transforms to the array and send them to the server

    Returns void

  • Connect to a server and room

    TODO Split to allow listing rooms first

    Parameters

    • joinData: {
          [key: string]: any;
      }

      Extra data to send while joining

      • [key: string]: any
    • options: Partial<WonderlandClientOptions> = {}

      Wonderlandclient options

    Returns Promise<number[]>

  • Remove a network component object from the internal storage

    Parameters

    • id: number

      {number} ID of the networked object

    Returns void

  • Set the mute status of a player and send this to the custom server implementation.

    Parameters

    • targetId: string

      {string} peer id of the player, which you get from the server when receiving a user joined event

    • mute: boolean

      {boolean} if the player should be muted or not

    Returns void

Generated using TypeDoc