Comments (16)
That should definitely not be happening. Do you see the same behavior on http://cdn.peerjs.com/demo/chat.html?
from peerjs.
Yeah, It's the same for me. Here are the exact steps I'm taking:
Peer 1: peer.connect('Peer 2 ID');
Peer 1: peer.connections['Peer 2 ID'].send('hello'); //works properly
Peer 2: peer.connections['Peer 1 ID'].send('hello'); //doesn't do anything
from peerjs.
I've seen this before--it happens when one peer does not receive all of the ice candidates of the other. But as Eric said, this should not be happening anymore.
Could you paste the logs from the console on both peers when trying to connect on http://cdn.peerjs.com/demo/chat.html?
from peerjs.
Sure!
Peer 1:
PeerJS: Socket open peer.js:751
> peer.connect('75avj2e30mpzm2t9');
PeerJS: Creating RTCPeerConnection peer.js:751
PeerJS: Listening for ICE candidates peer.js:751
PeerJS: Listening for `negotiationneeded` peer.js:751
PeerJS: Creating data channel peer.js:751
DataConnection {_events: Object, _options: Object, open: false, id: "fwdh6ly7pvmzehfr", peer: "75avj2e30mpzm2t9"…}
PeerJS: `negotiationneeded` triggered peer.js:751
PeerJS: Created offer peer.js:751
PeerJS: Set localDescription to offer peer.js:751
PeerJS: Received ICE candidates peer.js:751
PeerJS: Set remoteDescription: ANSWER peer.js:751
PeerJS: Added ice candidate peer.js:751
PeerJS: Data channel connection success peer.js:751
> peer.connections['75avj2e30mpzm2t9'].send('hello'); //this works
undefined
Peer 2:
PeerJS: Socket open peer.js:751
PeerJS: Creating RTCPeerConnection peer.js:751
PeerJS: Listening for ICE candidates peer.js:751
PeerJS: Listening for `negotiationneeded` peer.js:751
PeerJS: Listening for data channel peer.js:751
PeerJS: Added ice candidate peer.js:751
PeerJS: Received data channel peer.js:751
PeerJS: Set remoteDescription: OFFER peer.js:751
PeerJS: Created answer peer.js:751
PeerJS: Set localDescription to answer peer.js:751
PeerJS: Received ICE candidates peer.js:751
PeerJS: Added ice candidate peer.js:751
PeerJS: Received ICE candidates peer.js:751
PeerJS: Data channel connection success peer.js:751
> peer.connections
Object {fwdh6ly7pvmzehfr: DataConnection}
> peer.connections['fwdh6ly7pvmzehfr'].send('hello'); //this does nothing
undefined
from peerjs.
Awesome, thanks :). I will see if I can reproduce it. You're on latest Canary, using two tabs?
from peerjs.
Yup!
On Thu, Feb 14, 2013 at 4:26 PM, Michelle Bu [email protected]
wrote:
I will see if I can reproduce it. You're on latest Canary, using two tabs?
Reply to this email directly or view it on GitHub:
#9 (comment)
from peerjs.
I wound up just treating it like readonly writeonly streams and opening a connection back on a "connection" event
It's up and running here
in some ways this might be considered a feature rather than a bug? Although I can't think of a good use case off the top of my head.
from peerjs.
That's really weird. I still haven't been able to reproduce this single directional connection bug. Any more details on OS, exact Chrome build, etc?
The fact that the 'Data channel connection success' message logs means that the DataChannel is in the open state, at which point the transfer of data is no longer in PeerJS's control. That being said, you guys should try out some of the other demos, like 'http://sharefest.peer5.com/' that DON'T use PeerJS to see if you have similar issues.
Edit: Actually there's very few 2-way DataChannel demos that would actually test this kind of functionality, but it seems that similar one-way problems are happening with WebRTC media streams as well, so we'll just keep up to date with commit logs and see what happens.
from peerjs.
@whytheplatypus We just tried it and it works! Cool stuff. I also cloned it myself and took out the extra connection when a 'connection' event is fired. This also worked for me, so this is still a pretty weird bug.
from peerjs.
Little more info on the bug:
Uncaught Error: InvalidStateError: DOM Exception 11 peer.js:1315
(anonymous function) peer.js:1315
fr.onload peer.js:795
it looks like this has something to do with self._dc.send(str);
but I haven't dug deep enough to know what yet.
Oh this is also with running a local PeerServer.. no idea if that makes a difference.
glad you liked the chat thing :P this stuff is so much fun to work with
from peerjs.
@whytheplatypus Does the 'open' event on that connection object ever fire? What is connection._dc.readyState
? Using a local PeerServer should not matter. I actually just ran some connection speed benchmarks today using the latest version of the server on npm and the connections seemed to be just fine.
It seems to be happening to only a handful of people; really wish I could repro.
from peerjs.
Could it be due to firewalls?
from peerjs.
Alright well it looks like there's no bug after all.. at least for me.. I just wasn't listening for the data event in the right place. There's no new 'connection' event on the peer that called peer.connect(id) so it wasn't listening for any 'data' events.
adding
conn.on('data', function(data){
//code
});
after
var conn = peer.connect(id);
was all that I needed...
from peerjs.
Glad to hear it :)
from peerjs.
I believe this is just due to firewalls and is not a bug in PeerJS, so I'm closing this for now.
from peerjs.
I see this is a really old issue, however this problem is occuring for me on the official chat demo http://cdn.peerjs.com/demo/chat.html
Chromium
Version 58.0.3029.110 Built on Ubuntu , running on Ubuntu 16.04 (64-bit)
I have a standard NAT setup, and can get bidirectional data working just fine with WebRTC itself.
Edit:
I was just thinking this could be an issue with Peer 1 sending to my local private IP address, and peer 2 trying to send to my public IP address that has not been hole punched yet. Just a thought.
from peerjs.
Related Issues (20)
- Add support for nodejs server HOT 1
- Peerjs Not Starting On Localhost HOT 1
- Screen Sharing stream while answering a call has 3 tracks - (audio, camera and screen) but the call.on("stream", callback) receives only 2 tracks
- Reconnect solutions
- React-native-peerjs 'stream' is not emitting HOT 1
- Status page show incorrect server status HOT 2
- ERROR PeerJS: Error: Could not connect to peer
- Peerjs reconnecting not working fine sometime one of the device is not connected
- Having problem with Blob in v 1.5.1 peerjs.min.js HOT 6
- Insufficient postMessage Validation HOT 2
- ReferenceError: navigator is not defined when using nestjs HOT 4
- Call answer for a stream coming from screen share on peer which does not have a webcam shows nothing HOT 2
- New maintainer(s) wanted!
- connection problem HOT 3
- Play() was interrupted by new load request
- Peer TURN servers seems to be down HOT 2
- peer.connect not open on some users
- Remote video stream shows black screen. HOT 2
- Works only for same network HOT 5
- Remote video transmission not working again
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from peerjs.