widget/Connection

Vue SFC used as a widget that shows the element in the array given in props in a html list. All list element are buttons that, when clicked, request a connection/emit an event on the bus (given in props). It manages the different state on the connection and change a badge to give visual feedback to the user on it. The array given should contains the name and the id of the easyRTC peers that are in the connected room. The component calling this one should manage the easyRTC part and the connection, this component only show peers and manage the connection selection. This component have the following dependencies : Bootstrap-Vue for styling.

Props

Name Type Default value Required? Description
seflId Number - Yes Application's easyrtc Id.
peersTable Array.<String> - Yes Array of robot in the room.
bus Vue - Yes Vue bus use to emit event to other components.

Data

Name Type Default value Description
isConnected Boolean - Current connection state, only one connection is allowed.
isConnectedToPeerId Number - Peer Id, name should be change...
waitingForConnectionState Boolean - Indicate if connection in progress.

Events

Name Payload Type Description
peer-connection Number Send the peer id to Layout for connection state change.

Methods

connectToPeer(peerId)

Ask to be connected to a peer by emitting event.
Source:
Parameters:
Name Type Description
peerId Number Peer Id to connect to.

disconnectFromPeer(peerId)

Ask to be disconnect from the current connected peer by emitting an event.
Source:
Parameters:
Name Type Description
peerId Number Peer Id currently connected to.

handleConnectionChanged(state)

Callback the connection-changed event.
Source:
Parameters:
Name Type Description
state String New state of the connection.

handlePeerConnection(peerId)

HTML button callback to handle the connection/disconnection to a peer.
Source:
Parameters:
Name Type Description
peerId Number Peer Id associated with the button.