35,99 €
If you are a JavaScript developer with a basic knowledge of WebRTC and software development, but want to explore how to use it in more depth, this book is for you.
Das E-Book können Sie in Legimi-Apps oder einer beliebigen App lesen, die das folgende Format unterstützen:
Seitenzahl: 218
Veröffentlichungsjahr: 2015
Copyright © 2015 Packt Publishing
All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews.
Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the author, nor Packt Publishing, and its dealers and distributors will be held liable for any damages caused or alleged to be caused directly or indirectly by this book.
Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information.
First published: February 2015
Production reference: 1200215
Published by Packt Publishing Ltd.
Livery Place
35 Livery Street
Birmingham B3 2PB, UK.
ISBN 978-1-78328-445-0
www.packtpub.com
Author
Andrii Sergiienko
Reviewers
Pasquale Boemio
Jose López
Marcos de Vera Piquero
Commissioning Editor
Usha Iyer
Acquisition Editor
Sam Wood
Content Development Editor
Rahul Nair
Technical Editor
Siddhi Rane
Copy Editor
Neha Vyas
Project Coordinator
Judie Jose
Proofreaders
Ting Baker
Simran Bhogal
Maria Gould
Paul Hindle
Indexer
Hemangini Bari
Production Coordinator
Melwyn Dsa
Cover Work
Melwyn Dsa
Andrii Sergiienko is a computer software developer from Ukraine and is passionate about information technologies. From his early childhood, he was interested in computer programming and hardware. He took his first step into these fields more than 20 years ago. He has experience of a wide set of languages and technologies including C, C++, Java, assembly language, Erlang, JavaScript, PHP, Riak, shell scripting, computer networks, and security.
During his career he worked for both small, local companies such as domestic ISP and large, worldwide corporations such as Hewlett Packard. He also started his own projects—some of them were relatively successful.
Today, he is the owner and inspirer of OSLIKAS OÜ, a computer software company with headquarters in Estonia. The company (http://www.oslikas.com) focuses on modern IT technologies and solutions.
Working on this book was a really great and interesting experience for me. All this would be impossible without the help of certain people. And now is the time for me to say thank you to them.
First of all, I would like to thank my parents Olga and Alexander for my happy childhood that established the foundation for my life and career.
I would like to say thank you to my wife Inna for her patience, encouragement, and support during this process.
I would like to thank the Packt Publishing team as well. These guys are doing really great work and making the world a better place. We contacted some of them directly during the work, and others stayed behind the scenes. However, I know that a lot of people spent part of their lives to make this book possible. Thank you all.
Pasquale Boemio fell in love with Linux and the open source philosophy at the age of 12. Following this passion, he studied computer engineering at University of Naples Federico II from where he graduated with a master's degree.
Currently, he is working as a researcher in the Department of Electrical Engineering and Information Technology (DIETI) in the University of Naples Federico II, contributing to the development of real-time communication technologies. His efforts in this field are concretized by supporting the Meetecho project (www.meetecho.com).
Meetecho is a university spin-off and a tool for the collaborative work currently used by the Internet Engineering Task Force (IETF) to provide remote participation to the working groups. Meetecho leverages some state-of-the-art technologies (such as WebRTC and Docker) to implement a comprehensive architecture that can be lightweight and portable. Meetecho's best project is the Janus WebRTC Gateway (http://janus.conf.meetecho.com/), mentioned later in this book, which allows a user the ability to integrate different, real-time technologies without any pains.
In his spare time, Pasquale works on some personal open source projects (https://github.com/helloIAmPau) and helps the community by giving his contributions to cool projects found on the GitHub platform.
He has already worked with Packt Publishing by reviewing WebRTC Integrator's Guide, a useful guide for anyone who needs to integrate WebRTC with a retro technology such as SIP.
Jose López was born in Galicia, Spain. He is a telecommunications engineer with a large amount of experience in software development, and is also focused on real-time audio/video communications. He started working for Quobis Networks in 2013, a leading company in WebRTC solutions.
Marcos de Vera Piquero is a software engineer who has mainly worked with Python and CoffeeScript. His area of development is now focused on the server side of real-time multimedia applications at Quobis, his current employer. He's also a free software enthusiast and is trying to make it a real alternative.
For support files and downloads related to your book, please visit www.PacktPub.com.
Did you know that Packt offers eBook versions of every book published, with PDF and ePub files available? You can upgrade to the eBook version at www.PacktPub.com and as a print book customer, you are entitled to a discount on the eBook copy. Get in touch with us at <[email protected]> for more details.
At www.PacktPub.com, you can also read a collection of free technical articles, sign up for a range of free newsletters and receive exclusive discounts and offers on Packt books and eBooks.
https://www2.packtpub.com/books/subscription/packtlib
Do you need instant solutions to your IT questions? PacktLib is Packt's online digital book library. Here, you can search, access, and read Packt's entire library of books.
If you have an account with Packt at www.PacktPub.com, you can use this to access PacktLib today and view 9 entirely free books. Simply use your login credentials for immediate access.
WebRTC is a relatively new and revolutionary technology that opens new horizons in the area of interactive applications and services. Most of the popular web browsers support it natively (such as Chrome and Firefox) or via extensions (such as Safari). Mobile platforms such as Android and iOS allow you to develop native WebRTC applications.
This book covers a wide set of topics on how to develop software using a WebRTC stack. Using practical recipes, it considers basic concepts, security, debugging, integration with other technologies, and other important themes of the development process in a friendly manner.
You will not only learn about WebRTC-specific features, but also attendant technologies (CSS3, HTML5, and WebSockets), and how to use them along with WebRTC.
Chapter 1, Peer Connections, introduces you to the very basic concepts of WebRTC. This includes practical recipes on peer connections. You will also find simple demo applications in this chapter.
Chapter 2, Supporting Security, leads you through various security-related topics and covers how to secure a typical WebRTC application's infrastructure components: SSL/TLS certificates, WebSockets, web servers, STUN/TURN, data channels, and more.
Chapter 3, Integrating WebRTC, considers integrating a WebRTC application with other technologies and third-party software. This chapter describes practical cases and solutions on integration.
Chapter 4, Debugging a WebRTC Application, is dedicated to application debugging—an important topic of the software development process. In this chapter, you will learn about the topics relating to debugging in the scope of WebRTC.
Chapter 5, Working with Filters, teaches you how to use CSS3 filters with WebRTC applications. This chapter also covers custom image processing.
Chapter 6, Native Applications, contains practical, step-by-step recipes dedicated to developing native WebRTC applications on mobile platforms.
Chapter 7, Third-party Libraries, describes general use cases and practical solutions based on third-party WebRTC frameworks and services.
Chapter 8, Advanced Functions, covers how to use advanced WebRTC features. It contains practical recipes on file transferring, streaming, audio/video controlling, and more.
To use the recipes and codes provided and considered in this book, you will need a few pieces of software installed:
Specific requirements and configurations along with suggested solutions are considered in particular chapters.
This book is written as a set of ready-to-use, practical recipes that cover a variety of topics related to developing WebRTC applications and services. It is assumed that you are familiar, in general, with WebRTC and its basic concepts.
Most of the provided recipes are written in JavaScript. However, server-side parts of applications are implemented in Erlang and Java. So, you are assumed to have at least basic experience with one of these technologies.
Working on some cases described in this book, you will have to deal with a Linux-based OS. All recipes are provided as a step-by-step guide. Although, if you have experience of working with and configuring Linux-based boxes, it would be useful.
So, this book is for someone who is familiar, in general, with the WebRTC stack, and who has at least basic skills in software development.
Feedback from our readers is always welcome. Let us know what you think about this book—what you liked or disliked. Reader feedback is important for us as it helps us develop titles that you will really get the most out of.
To send us general feedback, simply e-mail <[email protected]>, and mention the book's title in the subject of your message.
If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, see our author guide at www.packtpub.com/authors.
Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.
You can download the example code files from your account at http://www.packtpub.com for all the Packt Publishing books you have purchased. If you purchased this book elsewhere, you can visit http://www.packtpub.com/support and register to have the files e-mailed directly to you.
We also provide you with a PDF file that has color images of the screenshots/diagrams used in this book. The color images will help you better understand the changes in the output. You can download this file from: https://www.packtpub.com/sites/default/files/downloads/4450OS_ColoredImages.pdf.
Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you find a mistake in one of our books—maybe a mistake in the text or the code—we would be grateful if you could report this to us. By doing so, you can save other readers from frustration and help us improve subsequent versions of this book. If you find any errata, please report them by visiting http://www.packtpub.com/submit-errata, selecting your book, clicking on the ErrataSubmissionForm link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata will be uploaded to our website or added to any list of existing errata under the Errata section of that title.
To view the previously submitted errata, go to https://www.packtpub.com/books/content/support and enter the name of the book in the search field. The required information will appear under the Errata section.
Piracy of copyrighted material on the Internet is an ongoing problem across all media. At Packt, we take the protection of our copyright and licenses very seriously. If you come across any illegal copies of our works in any form on the Internet, please provide us with the location address or website name immediately so that we can pursue a remedy.
Please contact us at <[email protected]> with a link to the suspected pirated material.
We appreciate your help in protecting our authors and our ability to bring you valuable content.
If you have a problem with any aspect of this book, you can contact us at <[email protected]>, and we will do our best to address the problem.
In this chapter, we will cover the following topics:
This chapter covers the basic concepts of how to use WebRTC when developing rich media web applications and services.
With simple and short recipes, you will learn how to create your own signaling server. The key data that needs to be exchanged by peers before they establish a direct connection is called the session description—it specifies the peers' configuration. Signaling server is a component in an application's infrastructure that is accessible by all peers and serves to exchange multimedia's session description. The way peers should exchange data is not described by WebRTC standards, so you should make the decision on your own regarding the protocol and mechanism you will use for this task.
You can build a signaling server using any programming language and technology you like. In general, the signaling protocol can be non-technical and is possible to implement in away where the peers would use just a sheet of paper to exchange necessary data between each other. In this chapter, we use WebSocket to implement signaling, although you can use any other protocol.
The signaling stage is represented in the schema that is shown in the following diagram:
In this chapter, you will find two recipes that are dedicated to signaling server development: Building a signaling server in Erlang and Building a signaling server in Java. Java is probably the most popular and known technology, and it would be easy to get into this topic using Java, even if you don't have programming experience with this technology. Erlang is not widely known yet. Nonetheless, this is a very mature technology, very suitable for writing lightweight and extremely fast server applications with perfect scalability. So, by learning signaling server, you will find simple solutions in Erlang as well.
This chapter also covers the basic use case of how to use WebRTC data channels: file transferring and peer-to-peer chat.
You will also learn how to configure and use Session Traversal Utilities for NAT (STUN) and Traversal Using Relays around NAT (TURN) services, and of course, this chapter covers making peer-to-peer calls using WebRTC.
Note that in this chapter, we will cover the process of making computer-to-computer calls. If you want to know more about how to use WebRTC with VoIP and SIP, and how to make phone calls from a web page, refer to the Chapter 3, Integrating WebRTC.