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

Section 10.1 (Simple Peer-to-peer Example) should explicitly handle "answer" type #388

Closed
a2sheppy opened this issue Nov 9, 2015 · 0 comments · Fixed by #449
Closed

Comments

@a2sheppy
Copy link

a2sheppy commented Nov 9, 2015

The sample, while functionally correct, doesn't actually look for the type "answer" on the SDP; instead, it assumes that anything that's not an "offer" is an "answer". While this may or may not be true in the context of this specific example, it makes the example unclear -- it took me a while, I'm afraid, to realize that these two lines were in fact handling the "answer":

        } else
            pc.setRemoteDescription(desc).catch(logError);

I propose changing this to:

        } else if (desc.type == "answer") {
            pc.setRemoteDescription(desc).catch(logError);
        } else {
            log("Unsupported SDP type. Your code may differ here.");
        }

This would make the example easier and faster to comprehend and actually makes the entire onmessage handler much more obvious.

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