Skip to content

Commit

Permalink
Merge pull request #2798 from WofWca/patch-1
Browse files Browse the repository at this point in the history
Adjust an example
  • Loading branch information
jan-ivar committed Nov 17, 2022
2 parents 90dc200 + c333864 commit f7f0e9e
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions webrtc.html
Expand Up @@ -16391,15 +16391,14 @@ <h3>
channel.onopen = () =&gt; input.disabled = false;
channel.onmessage = ({data}) =&gt; showChatMessage(data);

input.onkeypress = ({keyCode}) =&gt; {
// only send when user presses enter
if (keyCode != 13) return;
input.onkeydown = ({key}) =&gt; {
if (key != 'Enter') return;
channel.send(input.value);
}
}

signaling.onmessage = async ({data: {description, candidate}}) =&gt; {
if (!pc) start(false);
if (!pc) start();

try {
if (description) {
Expand Down

0 comments on commit f7f0e9e

Please sign in to comment.