官术网_书友最值得收藏!

  • WebRTC Blueprints
  • Andrii Sergiienko
  • 681字
  • 2021-07-16 11:42:53

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.

主站蜘蛛池模板: 阳泉市| 大关县| 邳州市| 泗洪县| 温宿县| 蚌埠市| 阿拉善右旗| 聂荣县| 三明市| 馆陶县| 仪征市| 叙永县| 吉隆县| 灵武市| 瑞安市| 玉林市| 科技| 阳曲县| 崇阳县| 剑阁县| 弥渡县| 荃湾区| 密云县| 安西县| 高雄市| 中超| 新营市| 澄江县| 商城县| 武川县| 乐山市| 凤阳县| 汾西县| 瑞丽市| 襄城县| 勃利县| 涞源县| 曲麻莱县| 年辖:市辖区| 任丘市| 新余市|