Search icon
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Learning WebRTC

You're reading from  Learning WebRTC

Product type Book
Published in Jun 2015
Publisher
ISBN-13 9781783983667
Pages 186 pages
Edition 1st Edition
Languages
Author (1):
Daniel M. Ristic Daniel M. Ristic
Profile icon Daniel M. Ristic

Table of Contents (16) Chapters

Learning WebRTC
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
1. Getting Started with WebRTC 2. Getting the User's Media 3. Creating a Basic WebRTC Application 4. Creating a Signaling Server 5. Connecting Clients Together 6. Sending Data with WebRTC 7. File Sharing 8. Advanced Security and Large-scale Optimization Answers to Self-test Questions Index

Adding text-based chat


Now we will use what we have learned in this chapter to add data channel support to our communication application. Since the data channel can be used for any arbitrary data, we are going to add text-based chat as another feature of our application. The users will have a text box to enter a message into and a display of all the messages in the current call. When we are finished, it will end up looking something similar to this:

To get started, we will change the call page of our application. We will add three new elements—an input text field, a button, and a div. The input area and button will allow the user to enter text while div will hold all the messages between each user.

<div id="call-page" class="page">
      <video id="yours" autoplay></video>
      <video id="theirs" autoplay></video>
      <input type="text" id="their-username" />
      <button id="call">Call</button>
      <button id="hang-up">Hang Up<...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime}