Commit 8de33f8c authored by lazorfuzz's avatar lazorfuzz
Browse files

Modify channelOepn event to include peer

parent 876951bb
......@@ -59,7 +59,7 @@ const webrtc = new LioWebRTC({
```
### Partial mesh network
Peers only form direct connections with a maximum of maxPeers and a minimum of minPeers. shout()ing still works because peers wil re-propagate messages to other peers. Note: partial mesh networks only work if you're only using data channels.
Peers only form direct connections with a maximum of maxPeers and a minimum of minPeers. shout()ing still works because peers wil re-propagate messages to other peers. Note: partial mesh networks only work if you're only using `dataOnly`.
```js
const webrtc = new LioWebRTC({
dataOnly: true,
......@@ -304,6 +304,7 @@ this.webrtc.on('receivedPeerData', (type, payload, peer) => {
// Find something to do with the data
});
```
`'channelOpen', RTCDataChannel, peer` - emitted when a new channel is established with a peer.
`'connectionReady', sessionId` - emitted when the signaling connection emits the
`connect` event, with the unique id for the session.
......
......@@ -169,7 +169,7 @@ class Peer extends WildEmitter {
channel.onmessage = (event) => {
self.emit('channelMessage', self, channel.label, JSON.parse(event.data), channel, event);
};
channel.onopen = this.emit.bind(this, 'channelOpen', channel);
channel.onopen = this.emit.bind(this, 'channelOpen', channel, self);
}
// Fetch or create a data channel by the given name
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment