Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Calling send before the channel is open doesn't buffer data? #690

Closed
lazerwalker opened this issue Jun 24, 2020 · 2 comments · Fixed by #766
Closed

Calling send before the channel is open doesn't buffer data? #690

lazerwalker opened this issue Jun 24, 2020 · 2 comments · Fixed by #766

Comments

@lazerwalker
Copy link

The README claims that if you try to send data before a connection has been established, the send method will buffer that message until it's ready: https://github.com/feross/simple-peer/blob/master/README.md#peersenddata

This isn't happening for me in practice — trying to send before receiving a connect message gives me an error that the RTCDataChannel.readyState is not 'open'.

Looking at the code, peer.send appears to just delegate straight to the underlying WebRTC method: https://github.com/feross/simple-peer/blob/master/index.js#L243-L245

I'm guessing the correct fix here is to just delete that sentence from the README (happy to open a PR), but curious if there's something I'm doing wrong or misunderstanding, or if you have other thoughts.

@t-mullen
Copy link
Collaborator

t-mullen commented Jul 9, 2020

You're correct, peer.send does not buffer and the documentation shouldn't say this.

peer.write does buffer.

@feross
Copy link
Owner

feross commented Nov 23, 2020

Docs updated in PR: #766

FredZeng pushed a commit to FredZeng/simple-peer that referenced this issue Oct 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants