Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletter Hub
Free Learning
Arrow right icon
timer SALE ENDS IN
0 Days
:
00 Hours
:
00 Minutes
:
00 Seconds
Getting Started with WebRTC
Getting Started with WebRTC

Getting Started with WebRTC: If you have basic HTML and JavaScript, you're well on the way to adding real time, peer-to-peer communication to your web applications using WebRTC. This book shows you how through a totally practical, structured course.

eBook
$9.99 $21.99
Paperback
$36.99
Subscription
Free Trial
Renews at $19.99p/m

What do you get with a Packt Subscription?

Free for first 7 days. $19.99 p/m after that. Cancel any time!
Product feature icon Unlimited ad-free access to the largest independent learning library in tech. Access this title and thousands more!
Product feature icon 50+ new titles added per month, including many first-to-market concepts and exclusive early access to books as they are being written.
Product feature icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Product feature icon Thousands of reference materials covering every tech concept you need to stay up to date.
Subscribe now
View plans & pricing
Table of content icon View table of contents Preview book icon Preview Book

Getting Started with WebRTC

Chapter 1. An Introduction to Web-based Real-Time Communication

This chapter introduces you to the concepts behind the new Web-based Real-Time Communication (WebRTC) standards. After reading this chapter, you will have a clear understanding of:

  • What is WebRTC

  • How you can use it

  • Which web browsers support it

Introducing WebRTC


When the World Wide Web (WWW) was first created in the early 1990's, it was built upon a page-centric model that used HREF-based hyperlinks. In this early model of the web, browsers navigated from one page to another in order to present new content and to update their HTML-based user interfaces.

Around the year 2000, a new approach to web browsing had started to develop, and by the middle of that decade, it had become standardized as the XMLHttpRequest (XHR) API. This new XHR API enabled web developers to create web applications that didn't need to navigate to a new page to update their content or user interface. It allowed them to utilize server-based web services that provided access to structured data and snippets of pages or other content. This led to a whole new approach to the web, which is now commonly referred to as Web 2.0. The introduction of this new XHR API enabled services such as Gmail, Facebook, Twitter, and more to create a much more dynamic and social web for us.

Now the web is undergoing yet another transformation that enables individual web browsers to stream data directly to each other without the need for sending it via intermediary servers. This new form of peer-to-peer communication is built upon a new set of APIs that is being standardized by the Web Real-Time Communications Working Group available at http://www.w3.org/2011/04/webrtc/ of the World Wide Web Consortium (W3C), and a set of protocols standardized by Real-Time Communication in WEB-browsers Working Group available at http://tools.ietf.org/wg/rtcweb/ of the Internet Engineering Task Force (IETF).

Just as the introduction of the XHR API led to the Web 2.0 revolution, the introduction of the new WebRTC standards is creating a new revolution too.

It's time to say hello to the real-time web!

Uses for WebRTC


The real-time web allows you to set up dynamic connections to other web browsers and web-enabled devices quickly and easily. This opens the door to a whole new range of peer-to-peer communication, including text-based chat, file sharing, screen sharing, gaming, sensor data feeds, audio calls, video chat, and more. You can now see that the implications of WebRTC are very broad. Direct and secure peer-to-peer communication between browsers will have a big impact on the modern web, reshaping the way we use the physical networks that make up the Internet.

Direct peer-to-peer connections often provide lower latency, making gaming, video streaming, sensor data feeds, and so on, appear faster and more interactive or real-time, hence the use of this term.

Secure peer-to-peer connections allow you to exchange information privately without it being logged or managed by intermediary servers. This reduces the need for some large service providers while creating opportunities for people to create new types of services and applications. It introduces improved privacy for some individuals while it may also create new complexities for regulators and law enforcement organizations.

And the efficient peer-to-peer exchange of binary data streams removes the need to serialize, re-encode, or convert this data at each step in the process. This leads to a much more efficient use of network and application resources, as well as creating a less error prone and more robust data exchange pipeline.

This is just a brief overview of how you can use WebRTC, and by the end of this book, you will have all the information you need to start turning your own new ideas into practical applications.

Try WebRTC yourself right now!


The goal of this book is to get you started with WebRTC, so let's do that right now. You can easily find out if your browser supports the camera access functionality by visiting one of the existing demo sites such as http://www.simpl.info/getusermedia, and if it does, you should be prompted to provide permission to share your camera. Once you provide this permission, you should see a web page with a live video stream from your PC or mobile devices' video camera, and be experiencing the interesting sensation of looking at a video of yourself staring right back at you. That's how simple it is to start using WebRTC.

Now, perhaps you'd like to try using it to communicate with another person. You can do this by visiting another demo site such as http://apprtc.appspot.com, which will create a unique URL for your video chat. Just send this URL to another person with a browser that also supports WebRTC, and once they open that page, you should see two video elements displayed on the page: one from your local video camera and one from the other person's video camera. There's a lot of complex negotiation that's gone on in the background, but assuming your browser supports WebRTC and your network doesn't actively prevent it, then you should now have a clear idea of just how easy it is to use.

But what web browsers support WebRTC? Let's find out.

Browser compatibility


The WebRTC standards landscape is home to one of the fastest evolving communities on the web. One of the biggest challenges this creates is that of compatibility and interoperability. Here is an overview of what this is up to today and how to stay up-to-date as this continues to evolve.

Chrome and Firefox on the PC

At the time this chapter was written, WebRTC was supported as default by Chrome and Firefox on mainstream PC Operating Systems such as Mac OS X, Windows, and Linux. And most importantly, these two key implementations have been shown to communicate well with each other through a range of interoperability tests.

Tip

Have a look at the Hello Chrome, it's Firefox calling! blog post at https://hacks.mozilla.org/2013/02/hello-chrome-its-firefox-calling/.

Chrome and Firefox on Android

WebRTC is also available for Chrome and Firefox on the Android platform; however, currently you must manually configure certain settings to enable this functionality.

Here are the key steps you need to enable this for Chrome. These are from the Chrome for Android release notes posted on the discuss-webrtc forum available at https://groups.google.com/forum/#!topic/discuss-webrtc/uFOMhd-AG0A:

To enable WebRTC on Chrome for Android:

  1. Type in chrome://flags/ in the omnibox to access the flags.

  2. Scroll about a third down and enable the Enable WebRTC flag.

  3. You will be asked to relaunch the browser at the bottom of the page in order for the flag to take effect.

    Enabling WebRTC using Chrome flags on Android

Here are the key steps you need to enable WebRTC for Firefox. These are from a post on the Mozilla Hacks blog about the new Firefox for Android release available at https://hacks.mozilla.org/2013/04/webrtc-update-our-first-implementation-will-be-in-release-soon-welcome-to-the-party-but-please-watch-your-head/:

You can enable it by setting both the media.navigator.enabled pref and the media.peerconnection.enabled pref to "true" (browse to about:config and search for media.navigator.enabled and media.peerconnection.enabled in the list of prefs).

Enabling WebRTC using Firefox settings on Android

Opera

Opera has been an active supporter of the WebRTC movement and has implemented early versions of this standard in previous releases of their browsers. But at the time this chapter was written, they were working to port their collection of browsers to the WebKit platform based on the open Chromium project. So, until this migration activity is complete, their support for WebRTC is currently listed as unavailable.

However, since the Chromium project is closely related to Chrome, which is also built upon the WebKit platform, it is expected that Opera's support for WebRTC will develop quickly after this migration is complete.

Microsoft

Microsoft has proposed its own alternative to WebRTC named Customizable, Ubiquitous Real-Time Communication over the Web (CU-RTC-Web). Have a look at http://html5labs.interoperabilitybridges.com/cu-rtc-web/cu-rtc-web.htm.

As yet, it has not announced any timeline as to when Internet Explorer may support WebRTC, but it is currently possible to use WebRTC within Internet Explorer using the Chrome Frame solution available at https://developers.google.com/chrome/chrome-frame/.

Microsoft has also recently released prototypes that show interoperability in the form of a voice chat application connecting Chrome on a Mac and IE10 on Windows available at http://blogs.msdn.com/b/interoperability/archive/2013/01/17/ms-open-tech-publishes-html5-labs-prototype-of-a-customizable-ubiquitous-real-time-communication-over-the-web-api-proposal.aspx. This shows that one way or another, Microsoft understands the significance of the WebRTC movement, and it is actively engaging in the standards discussions.

Apple

Apple has not yet made any announcement about when they plan to support WebRTC in Safari on either OS X or iOS. So far, the only application that has made WebRTC available on iOS is an early proof of concept browser created by Ericsson Labs named Bowser, and is available at http://labs.ericsson.com/apps/bowser.

Note

Bowser is based upon a very early experimental version of the WebRTC standards, and it does not interoperate with any of the other mainstream web browsers.

However, as Safari is also based upon the WebKit platform just like Chrome and Opera, there should be no major technical barriers to prevent Apple from enabling WebRTC on both their mobile and PC browsers.

Staying up-to-date

It is also important to note that WebRTC is not a single API, but really a collection of APIs and protocols defined by a variety of Working Groups, and that the support for each of these are developing at different rates on different browsers and operating systems.

A great way to see where the latest level of support has reached is through services such as http://caniuse.com, which tracks broad adoption of modern APIs across multiple browsers and operating systems.

And, you should also check out the open project at http://www.webrtc.org, which is supported by Google, Mozilla, and Opera. This project provides a set of C++ libraries that are designed to help browser and application developers quickly and easily implement standards compliant with WebRTC functionality. It is also a useful site to find the latest information on browser support and some great WebRTC demos.

Summary


You should now have a clear overview of what the term WebRTC means and for what it can be used. You should be able to identify which browsers support WebRTC and have all the resources you need to find the latest up-to-date information on how this is evolving. You should also have been able to try the different aspects of WebRTC for yourself quickly and easily using your own browser if you so choose.

Next, we will take a more technical look at how the different WebRTC API components all fit together.

Then, we will start by fleshing out the simple peer-to-peer video call scenario into a fully working application.

Later, we will explore how this can be simplified down to just an audio only call or extended with text-based chat and file sharing.

And then, we will explore two real-world application scenarios based upon e-learning and team communication.

Left arrow icon Right arrow icon

Key benefits

  • Set up video calls easily with a low bandwidth audio only option using WebRTC
  • Extend your application using real-time text-based chat, and collaborate easily by adding real-time drag-and-drop file sharing
  • Create your own fully working WebRTC application in minutes

Description

WebRTC delivers web-based real-time communication and is set to revolutionize our view of what the Web really is. Streaming audio and video from browser to browser, as well as opening raw access to the camera and microphone, is already creating a whole new dynamic web. WebRTC also introduces real-time data channels that will allow interaction with dynamic data feeds from sensors and other devices. This really is a great time to be a web developer! Getting Started with WebRTC provides all of the practical information you need to quickly understand what WebRTC is, how it works, and how you can add it to your own web applications. It includes clear working examples designed to help you get started building your own WebRTC-enabled applications right away. Getting Started with WebRTC will guide you through the process of creating your own WebRTC application that can be applied in a number of different real-world situations, using well documented and clearly explained code examples. You will learn how to quickly and easily create a practical peer-to-peer video chat application, an audio only call option, and how a Web-Socket-based signaling server can also be used to enable real-time text-based chat. You will also be shown how this same server and application structure can easily be extended to include simple drag-and-drop file sharing with transfer updates and thumbnail previews.

Who is this book for?

This book is ideal for developers new to the WebRTC standards who are interested in adding sensor-driven, real-time, peer-to-peer communication to their web applications. You will only need basic experience with HTML and JavaScript.

What you will learn

  • Discover how to offer an audio only option as an alternative
  • Create an extensible Web Socket signaling server
  • Detect which browsers support WebRTC
  • Extend your application with real-time text-based chat
  • Add rich collaboration with drag-and-drop file sharing
  • Use RTCDataChannels to share real-time data
  • Design a state-based user interface for WebRTC apps
  • Explore the options available for image and audio post-processing and analysis

Product Details

Country selected
Publication date, Length, Edition, Language, ISBN-13
Publication date : Sep 25, 2013
Length: 114 pages
Edition : 1st
Language : English
ISBN-13 : 9781782166306
Vendor :
Node.js Developers
Languages :
Tools :

What do you get with a Packt Subscription?

Free for first 7 days. $19.99 p/m after that. Cancel any time!
Product feature icon Unlimited ad-free access to the largest independent learning library in tech. Access this title and thousands more!
Product feature icon 50+ new titles added per month, including many first-to-market concepts and exclusive early access to books as they are being written.
Product feature icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Product feature icon Thousands of reference materials covering every tech concept you need to stay up to date.
Subscribe now
View plans & pricing

Product Details

Publication date : Sep 25, 2013
Length: 114 pages
Edition : 1st
Language : English
ISBN-13 : 9781782166306
Vendor :
Node.js Developers
Languages :
Tools :

Packt Subscriptions

See our plans and pricing
Modal Close icon
$19.99 billed monthly
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Simple pricing, no contract
$199.99 billed annually
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just $5 each
Feature tick icon Exclusive print discounts
$279.99 billed in 18 months
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just $5 each
Feature tick icon Exclusive print discounts

Frequently bought together


Stars icon
Total $ 82.98
WebRTC Blueprints
$45.99
Getting Started with WebRTC
$36.99
Total $ 82.98 Stars icon
Banner background image

Table of Contents

8 Chapters
An Introduction to Web-based Real-Time Communication Chevron down icon Chevron up icon
A More Technical Introduction to Web-based Real-Time Communication Chevron down icon Chevron up icon
Creating a Real-time Video Call Chevron down icon Chevron up icon
Creating an Audio Only Call Chevron down icon Chevron up icon
Adding Text-based Chat Chevron down icon Chevron up icon
Adding File Sharing Chevron down icon Chevron up icon
Example Application 1 – Education and E-learning Chevron down icon Chevron up icon
Example Application 2 – Team Communication Chevron down icon Chevron up icon

Customer reviews

Top Reviews
Rating distribution
Full star icon Full star icon Full star icon Full star icon Half star icon 4.3
(12 Ratings)
5 star 66.7%
4 star 16.7%
3 star 0%
2 star 16.7%
1 star 0%
Filter icon Filter
Top Reviews

Filter reviews by




George Chen Mar 02, 2014
Full star icon Full star icon Full star icon Full star icon Full star icon 5
A good introduction for WebRTC.If you are new to the WebRTC, you should try it to get some useful knowledge.
Amazon Verified review Amazon
nacho Dec 04, 2013
Full star icon Full star icon Full star icon Full star icon Full star icon 5
This book makes a first introduction to WebRTC in a very general way, easy to understand for everyone.After this part, more technical details have been compiled so it also gives you a general overview of how a communication using WebRTC technology works and how to build your own service. The level of details in this part of the book I think is quite good for beginners.Finally, two scenarios are described in detail so the advantages of using WebRTC are shown. I really appreciate the sections highlighting the potential issues to be taken under account for each of the scenarios.As other user commented, I wish I could have had this book some months ago. Nevertheless, I would recommend it to anyone getting into WebRTC.
Amazon Verified review Amazon
Junaid Kirkire Apr 17, 2016
Full star icon Full star icon Full star icon Full star icon Full star icon 5
Great for programmers who want a hands-on introduction to WebRTC.
Amazon Verified review Amazon
Kader Khan Dec 22, 2013
Full star icon Full star icon Full star icon Full star icon Full star icon 5
Hi,I am not a developer since more than 10 years now. However I was curious to understand the basics of WebRTC from developer perpective. There were lot of resources in internet however was not clear enough to get started and as well to understand the whole picture.I read the "Getting Started with WebRTC" book, and i can say this book is well structured for the starters and leads to a way to advanced programming left to the one skills and imagination. The best part is the example working code and the clear exlanation is exemplenary.I for sure recommend this book for all individuals who needs to understand and excel in thier WebRTC world of Career.Best Regards,Kader.
Amazon Verified review Amazon
Peter C Salerno Nov 04, 2013
Full star icon Full star icon Full star icon Full star icon Full star icon 5
The book "Getting Started with WebRTC" by Rob Manson ( [...] )is an easy to understand introduction to building WebRTC applications. It is a good investment for anyone wanting to build the next generation of social networking services. The book can be view as having three sections: top-level, basic cookbook, and conciderations for advanced use cases.The first chapters cover the top-level information. Chapter 1 is a general introduction including a bit of the the why and who of WebRTC. Chapter 2 goes into the overall technical architecture. The information is organized and accurate, but it could benefit from a diagram or two to illustrate the text.Chapters 3 to 6 provide a cookbook approach. Starting with basic video and audio applications. There is an interesting twist where he adds a chatroulette feature to the application. Then the application is rounded out by adding in text chat and filesharing. Adding to the value of the bbok, the code for these chapters is available for download.The last two chapters focus on applying WebRTC in E-learning and Team Communication use-cases. Rob discusses consideration of the users and the network. Privacy, security and network adminstraion issues are rasied.Overall this is a very good book to get you started with WebRTC.
Amazon Verified review Amazon
Get free access to Packt library with over 7500+ books and video courses for 7 days!
Start Free Trial

FAQs

What is included in a Packt subscription? Chevron down icon Chevron up icon

A subscription provides you with full access to view all Packt and licnesed content online, this includes exclusive access to Early Access titles. Depending on the tier chosen you can also earn credits and discounts to use for owning content

How can I cancel my subscription? Chevron down icon Chevron up icon

To cancel your subscription with us simply go to the account page - found in the top right of the page or at https://subscription.packtpub.com/my-account/subscription - From here you will see the ‘cancel subscription’ button in the grey box with your subscription information in.

What are credits? Chevron down icon Chevron up icon

Credits can be earned from reading 40 section of any title within the payment cycle - a month starting from the day of subscription payment. You also earn a Credit every month if you subscribe to our annual or 18 month plans. Credits can be used to buy books DRM free, the same way that you would pay for a book. Your credits can be found in the subscription homepage - subscription.packtpub.com - clicking on ‘the my’ library dropdown and selecting ‘credits’.

What happens if an Early Access Course is cancelled? Chevron down icon Chevron up icon

Projects are rarely cancelled, but sometimes it's unavoidable. If an Early Access course is cancelled or excessively delayed, you can exchange your purchase for another course. For further details, please contact us here.

Where can I send feedback about an Early Access title? Chevron down icon Chevron up icon

If you have any feedback about the product you're reading, or Early Access in general, then please fill out a contact form here and we'll make sure the feedback gets to the right team. 

Can I download the code files for Early Access titles? Chevron down icon Chevron up icon

We try to ensure that all books in Early Access have code available to use, download, and fork on GitHub. This helps us be more agile in the development of the book, and helps keep the often changing code base of new versions and new technologies as up to date as possible. Unfortunately, however, there will be rare cases when it is not possible for us to have downloadable code samples available until publication.

When we publish the book, the code files will also be available to download from the Packt website.

How accurate is the publication date? Chevron down icon Chevron up icon

The publication date is as accurate as we can be at any point in the project. Unfortunately, delays can happen. Often those delays are out of our control, such as changes to the technology code base or delays in the tech release. We do our best to give you an accurate estimate of the publication date at any given time, and as more chapters are delivered, the more accurate the delivery date will become.

How will I know when new chapters are ready? Chevron down icon Chevron up icon

We'll let you know every time there has been an update to a course that you've bought in Early Access. You'll get an email to let you know there has been a new chapter, or a change to a previous chapter. The new chapters are automatically added to your account, so you can also check back there any time you're ready and download or read them online.

I am a Packt subscriber, do I get Early Access? Chevron down icon Chevron up icon

Yes, all Early Access content is fully available through your subscription. You will need to have a paid for or active trial subscription in order to access all titles.

How is Early Access delivered? Chevron down icon Chevron up icon

Early Access is currently only available as a PDF or through our online reader. As we make changes or add new chapters, the files in your Packt account will be updated so you can download them again or view them online immediately.

How do I buy Early Access content? Chevron down icon Chevron up icon

Early Access is a way of us getting our content to you quicker, but the method of buying the Early Access course is still the same. Just find the course you want to buy, go through the check-out steps, and you’ll get a confirmation email from us with information and a link to the relevant Early Access courses.

What is Early Access? Chevron down icon Chevron up icon

Keeping up to date with the latest technology is difficult; new versions, new frameworks, new techniques. This feature gives you a head-start to our content, as it's being created. With Early Access you'll receive each chapter as it's written, and get regular updates throughout the product's development, as well as the final course as soon as it's ready.We created Early Access as a means of giving you the information you need, as soon as it's available. As we go through the process of developing a course, 99% of it can be ready but we can't publish until that last 1% falls in to place. Early Access helps to unlock the potential of our content early, to help you start your learning when you need it most. You not only get access to every chapter as it's delivered, edited, and updated, but you'll also get the finalized, DRM-free product to download in any format you want when it's published. As a member of Packt, you'll also be eligible for our exclusive offers, including a free course every day, and discounts on new and popular titles.