API Docs for:
Show:

Connection Class

Defined in: src/connection.js:3

Represents a connection to another Wasabi instance.

Connections are sent objects according to their visibility groups, which can be set using addGroup and removeGroup, and created with Wasabi.createGroup. Connections start with no visibility groups. A connection with zero visibility groups will be sent all objects known to its Wasabi instance. If you want to send no objects to a connection, add an empty group to it.

Constructor

Connection

(
  • socket
  • ghostFrom
  • ghostTo
)
private

Defined in src/connection.js:3

Parameters:

  • socket Socket

    The socket.io socket used to communicate with the remote host

  • ghostFrom Boolean

    Accept ghosted NetObject from this client

  • ghostTo Boolean

    Ghost NetObjects to this client

Methods

addGroup

(
  • group
)

Add a group to this connection

Parameters:

  • group Group

    The group to add

getObjectsInGroups

() Object

Get a collection of all objects in the connection's groups

Returns:

Object:

A hash of serial numbers -> objects

removeGroup

(
  • group
)

Remove a group from this connection

Parameters:

  • group Group | Number

    The group or index to remove