Class: DataConnection

DataConnection

Class that manages data connections to other peers.

Members

(static) SERIALIZATIONS :Enum

Possible serializations for the DataConnection.
Type:
  • Enum

id

An id to uniquely identify the connection.

label :string

Label to easily identify the DataConnection on either peer.
Type:
  • string

metadata :object

Any additional information to send to the peer.
Type:
  • object

open :boolean

Whether the Connection has been opened or not.
Type:
  • boolean

peer :string

The remote peerId.
Type:
  • string
Deprecated:
  • Use remoteId instead.

remoteId :string

PeerId of the peer this connection is connected to.
Type:
  • string

type :string

The connection type. Either 'media' or 'data'.
Type:
  • string

Methods

close()

Disconnect from remote peer.
Fires:

send(data)

Send data to peer. If serialization is 'binary', it will chunk it before sending.
Parameters:
Name Type Description
data * The data to send to the peer.

Events

close

Connection closed event.