Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
WebRTC Blueprints

You're reading from   WebRTC Blueprints Develop your very own media applications and services using WebRTC

Arrow left icon
Product type Paperback
Published in May 2014
Publisher
ISBN-13 9781783983100
Length 176 pages
Edition Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
Andrii Sergiienko Andrii Sergiienko
Author Profile Icon Andrii Sergiienko
Andrii Sergiienko
Arrow right icon
View More author details
Toc

Table of Contents (13) Chapters Close

WebRTC Blueprints
Credits
About the Author
Acknowledgments
About the Reviewers
www.PacktPub.com
Preface
1. Developing a WebRTC Application FREE CHAPTER 2. Using the WebRTC Data API 3. The Media Streaming and Screen Casting Services 4. Security and Authentication 5. Mobile Platforms Index

Preparing the environment


Let's start with the setup:

  1. Create a folder for the whole application somewhere on your disk. Let's call it my_rtc_project.

  2. Create a directory named my_rtc_project/www. Here, we will put all the client-side code (JavaScript files or HTML pages).

  3. The signaling server's code will be placed under its separate folder, so create a directory for it and name it my_rtc_project /apps/rtcserver/src.

  4. Please note that we will use Git, a free and open source-distributed version control system. For Linux boxes, it can be installed using the default package manager. For a Windows system, I recommend that you install and use the implementation available at https://github.com/msysgit/msysgit.

  5. If you're using a Windows box, install msysgit and add a path to its bin folder to your PATH environment variable.

Installing Erlang

The signaling server is developed in the Erlang language. Erlang is a great choice to develop server-side applications due to the following reasons:

  • It is very comfortable and easy for prototyping

  • Its processes (aktors) are very lightweight and cheap

  • It does support network operations with no need of any external libraries

  • The code has been compiled to a bytecode that runs on a very powerful Erlang Virtual Machine

The following are some great projects developed using Erlang:

  • Yaws and Cowboy: These are web servers

  • Riak and CouchDB: These are distributed databases

  • Cloudant: This is a database service based on the forking of CouchDB

  • Ejabberd: This is an XMPP instant messaging service

  • Zotonic: This is a content management system

  • RabbitMQ: This is a message bus

  • Wings 3D: This is a 3D modeler

  • GitHub: This is a web-based hosting service for software development projects that use the Git versioning system

  • WhatsApp: This is a famous mobile messenger, sold to Facebook

  • Call of Duty: This is a computer game that uses Erlang on the server side

  • Goldman Sachs: This is a company that uses high-frequency trading computer programs

The following is a very brief history of Erlang:

  • 1982–1985: Ericsson starts experimenting with the programming of telecom, because existing languages weren't suitable for the task.

  • 1985–1986: Ericsson decides it must develop its own language with the desirable features of Lisp, Prolog, and Parlog. The language should have built-in concurrency and error recovery.

  • 1987: First experiments with a new language, Erlang.

  • 1988: Erlang is first used by external users out of the lab.

  • 1989: Ericsson works on the fast implementation of Erlang.

  • 1990: Erlang is presented at ISS'90 and gets new users.

  • 1991: A fast implementation of Erlang is released to users. Erlang is presented at Telecom'91 and gets a compiler and graphic interface.

  • 1992: Erlang gets a lot of new users. Ericsson ports Erlang to new platforms including VxWorks and Macintosh.

  • 1993: Erlang gets distribution. This makes it possible to run homogeneous Erlang systems on heterogeneous hardware. Ericsson starts selling Erlang implementations and Erlang Tools. A separate organization in Ericsson provides support.

Erlang is supported by many platforms. You can download it from the main website, http://www.erlang.org, and install it.

Installing Rebar

Actually, you can write Erlang programs and compile them without using any additional tools. Nevertheless, it is pretty easy to compile Erlang programs using the Rebar tool.

It works like a Make or auto tools for C or C++ applications and makes a developer's life easier.

You can download the Rebar tool from GitHub at https://github.com/basho/rebar.

The installation process is pretty simple:

git clone git://github.com/rebar/rebar.git
$ cd rebar
$ ./bootstrap
...
==> rebar (compile)
Congratulations!...

Now you have the Rebar executable in the folder where you downloaded the Rebar tool. Put it under a folder that is accessible with the PATH environment variable.

Configuring a web server

Configure the web server for your application's domain and point it to the my_rtc_project/www folder.

The basic application that we're considering in this chapter works fine without a web server; you can just open the index page in your web browser locally. Nevertheless, in the following chapters, we will touch on more advanced topics that will need to be configured on the web server in order to gain a better understanding of them.

You have been reading a chapter from
WebRTC Blueprints
Published in: May 2014
Publisher:
ISBN-13: 9781783983100
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 $19.99/month. Cancel anytime