0
votes

I'm using peerjs local server and open 2 browsers on same computer , I can send data from 1 browser to the second, but can't send from the second to the first. In debug I can see the connection of the first browser is open and the second is close. I have 2 question:

  • If 1 browser calls this.peer.connect('secondBrowser', {reliable: true}); , it created a datachannel that is two ways ?
  • should each browser call 'connect' to the other browser in order to make a two way data transfer ?

In console at 1st browser the log is :

Open connection to peer y6wfmyb0bg7jlan5

The 2nd browser is

PeerJS: Added ICE candidate for: 76xtuwxoiclxzvq3

1
Datachannels are full duplex, we can send/recv data in both directions. So creating the DataChannel from one side is sufficient. - Ajay
Do you have any Idea why in one browser the connection is open and in the other is closed ? - Haddar Macdasi
Is it triggering on close event ? github.com/peers/peerjs/blob/… - Ajay
No, I've added the log console - Haddar Macdasi
add a log in github.com/peers/peerjs/blob/… and check, does the data channel initialised in both the browsers or not? - Ajay

1 Answers

0
votes

Apparently the data channel created by peer.js is not two way channel.
So you have to connect from both browser.