{"id":320961,"date":"2021-04-06T15:00:10","date_gmt":"2021-04-06T15:00:10","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=320961"},"modified":"-0001-11-30T00:00:00","modified_gmt":"2021-04-06T15:00:10","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=320961","title":{"rendered":"\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0432\u0438\u0434\u0435\u043e\u0447\u0430\u0442\u0430 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e Node.js + Socket.io + WebRTC"},"content":{"rendered":"\n<div class=\"post__text post__text_v2\" id=\"post-content-body\">\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/82e\/c8b\/7e8\/82ec8b7e8fe705e78032d1d431f80f4b.png\" width=\"1000\" height=\"560\"><figcaption><\/figcaption><\/figure>\n<p>\u0421\u0435\u0433\u043e\u0434\u043d\u044f, \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u043e \u043a \u0441\u0442\u0430\u0440\u0442\u0443 <a href=\"https:\/\/skillfactory.ru\/webdev?utm_source=infopartners&amp;utm_medium=habr&amp;utm_campaign=habr_WEBDEV&amp;utm_term=regular&amp;utm_content=060421\">\u043d\u043e\u0432\u043e\u0433\u043e \u043f\u043e\u0442\u043e\u043a\u0430 \u043f\u043e \u0432\u0435\u0431-\u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0435,<\/a> \u043f\u043e\u0434\u0435\u043b\u0438\u043c\u0441\u044f \u0441 \u0432\u0430\u043c\u0438 \u0442\u0443\u0442\u043e\u0440\u0438\u0430\u043b\u043e\u043c, \u0438\u0437 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0432\u044b \u0443\u0437\u043d\u0430\u0435\u0442\u0435, \u043a\u0430\u043a \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0432\u0438\u0434\u0435\u043e\u0447\u0430\u0442 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e JavaScript \u0438 NodeJS. \u0422\u0430\u043a\u0436\u0435 \u0432\u044b \u043d\u0430\u0443\u0447\u0438\u0442\u0435\u0441\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c PeerJS, WebRTC \u0438 Socket.io.<\/p>\n<hr>\n<p><a href=\"https:\/\/video-chat-app-v1.herokuapp.com\/\"><u>\u0417\u0434\u0435\u0441\u044c<\/u><\/a> \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0443\u0432\u0438\u0434\u0435\u0442\u044c \u0436\u0438\u0432\u043e\u0439 \u043f\u0440\u0438\u043c\u0435\u0440 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0432\u044b \u0431\u0443\u0434\u0435\u0442\u0435 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c.<\/p>\n<h3>\u041f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0430 \u043a \u043f\u0440\u043e\u0435\u043a\u0442\u0443<\/h3>\n<p>\u0412\u043e\u0442 \u0447\u0442\u043e \u0432\u0430\u043c \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u0441\u044f:<\/p>\n<ul>\n<li>\n<p>NodeJS: \u043f\u043e\u0441\u0435\u0442\u0438\u0442\u0435 \u043e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0439 <a href=\"https:\/\/nodejs.org\/en\/\"><u>\u0432\u0435\u0431-\u0441\u0430\u0439\u0442 Node.js<\/u><\/a>, \u0447\u0442\u043e\u0431\u044b \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044c \u0438 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c Node;<\/p>\n<\/li>\n<li>\n<p>NPM: \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430 NPM \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u043d\u0430 \u0432\u0430\u0448 \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440 \u043f\u0440\u0438 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0435 Node.js.<\/p>\n<\/li>\n<\/ul>\n<h3>\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u043f\u0440\u043e\u0435\u043a\u0442\u0430<\/h3>\n<p>\u0412\u0435\u0441\u044c \u043a\u043e\u0434 \u044d\u0442\u043e\u0433\u043e \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0439\u0442\u0438 \u0432 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0438 GitHub.<\/p>\n<ol>\n<li>\n<p>\u0421\u043e\u0437\u0434\u0430\u0439\u0442\u0435 \u043f\u0443\u0441\u0442\u043e\u0439 \u043a\u0430\u0442\u0430\u043b\u043e\u0433 \u0441 \u0438\u043c\u0435\u043d\u0435\u043c video-chat-app.<\/p>\n<\/li>\n<li>\n<p>\u041e\u0442\u043a\u0440\u043e\u0439\u0442\u0435 \u043a\u043e\u043d\u0441\u043e\u043b\u044c, \u043f\u0435\u0440\u0435\u0439\u0434\u0438\u0442\u0435 \u0432 \u043d\u0430\u0448 \u043d\u043e\u0432\u044b\u0439 \u043a\u0430\u0442\u0430\u043b\u043e\u0433 \u0438 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u0435 npm init.<\/p>\n<\/li>\n<li>\n<p>\u0417\u0430\u043f\u043e\u043b\u043d\u0438\u0442\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u0443\u044e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u0434\u043b\u044f \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043d\u0430\u0448\u0435\u0433\u043e \u043f\u0440\u043e\u0435\u043a\u0442\u0430.<\/p>\n<\/li>\n<li>\n<p>\u0417\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u0435 npm install express ejs socket.io uuid peer. \u041a\u043e\u043c\u0430\u043d\u0434\u0430 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442 \u0432\u0441\u0435 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u044d\u0442\u043e\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f.<\/p>\n<\/li>\n<li>\n<p>\u0410 \u0442\u0430\u043a\u0436\u0435 \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 dev-\u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0435 <a href=\"https:\/\/nodemon.io\/\"><u>Nodemon<\/u><\/a>. \u041d\u0443\u0436\u043d\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c npm install-dev nodemon. \u042d\u0442\u043e \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442 nodemon \u043a\u0430\u043a dev-\u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u044c.<\/p>\n<\/li>\n<li>\n<p>\u0421\u043e\u0437\u0434\u0430\u0439\u0442\u0435 \u0444\u0430\u0439\u043b server.js \u2014 \u0432 \u044d\u0442\u043e\u043c \u0444\u0430\u0439\u043b\u0435 \u0431\u0443\u0434\u0435\u0442 \u0445\u0440\u0430\u043d\u0438\u0442\u044c\u0441\u044f \u0432\u0441\u044f \u0432\u0430\u0448\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u043d\u0430\u044f \u043b\u043e\u0433\u0438\u043a\u0430.<\/p>\n<\/li>\n<\/ol>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c, \u043a\u043e\u0433\u0434\u0430 \u0443 \u0432\u0430\u0441 \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043d \u043d\u0430\u0448 \u043f\u0440\u043e\u0435\u043a\u0442, \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u0440\u0438\u0441\u0442\u0443\u043f\u0438\u0442\u044c \u043a \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f!<\/p>\n<h3>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0441\u0435\u0440\u0432\u0435\u0440\u0430 (\u0441 Express JS)<\/h3>\n<p>\u041f\u0435\u0440\u0432\u043e\u0435, \u0447\u0442\u043e \u0432\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c, \u2014 \u044d\u0442\u043e \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u0432\u0430\u0448 \u0441\u0435\u0440\u0432\u0435\u0440. \u041c\u044b \u0441\u043e\u0431\u0438\u0440\u0430\u0435\u043c\u0441\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e Express. Express \u2014 \u044d\u0442\u043e \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u0438\u0441\u0442\u0438\u0447\u043d\u044b\u0439 \u0432\u0435\u0431-\u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a \u0434\u043b\u044f Node.js. Express \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043e\u0447\u0435\u043d\u044c \u043b\u0435\u0433\u043a\u043e \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0442\u044c \u0432\u0435\u0431-\u0441\u0435\u0440\u0432\u0435\u0440 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e Node.<\/p>\n<p>\u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0448\u0430\u0431\u043b\u043e\u043d\u043d\u044b\u0439 \u0444\u0430\u0439\u043b \u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f Express.<\/p>\n<pre><code class=\"javascript\">\/\/ server.js const express = require(\u201cexpress\u201d); const app = express(); const server = require(\u201chttp\u201d).Server(app); app.get(\u201c\/\u201d, (req, res) =&gt; {     res.status(200).send(\u201cHello World\u201d); }); server.listen(3030);<\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0432\u0430\u0448 \u0441\u0435\u0440\u0432\u0435\u0440 \u0437\u0430\u043f\u0443\u0449\u0435\u043d, \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u0440\u043e\u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0435\u0433\u043e, \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0432:<\/p>\n<pre><code>&gt; nodemon server.js<\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043e\u0442\u043a\u0440\u043e\u0439\u0442\u0435 \u0441\u0432\u043e\u0439 \u0431\u0440\u0430\u0443\u0437\u0435\u0440 \u0438 \u043f\u0435\u0440\u0435\u0439\u0434\u0438\u0442\u0435 \u043f\u043e \u0430\u0434\u0440\u0435\u0441\u0443: localhost:3000, \u0432\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u0443\u0432\u0438\u0434\u0435\u0442\u044c Hello World.<\/p>\n<figure class=\"\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/f32\/b4a\/b3f\/f32b4ab3f11c5020af1cc1d9baf1b376.png\" width=\"955\" height=\"487\"><figcaption><\/figcaption><\/figure>\n<h3>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043f\u0435\u0440\u0432\u043e\u0439 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b<\/h3>\n<p>\u0412\u043c\u0435\u0441\u0442\u043e \u0442\u043e\u0433\u043e \u0447\u0442\u043e\u0431\u044b \u0432\u044b\u0432\u043e\u0434\u0438\u0442\u044c \u0442\u0435\u043a\u0441\u0442, \u043a\u043e\u0433\u0434\u0430 \u043a\u0442\u043e-\u0442\u043e \u043f\u043e\u0441\u0435\u0449\u0430\u0435\u0442 \u0432\u0430\u0448 \u043a\u043e\u0440\u043d\u0435\u0432\u043e\u0439 \u043c\u0430\u0440\u0448\u0440\u0443\u0442, \u0432\u044b \u0445\u043e\u0442\u0435\u043b\u0438 \u0431\u044b \u043f\u0440\u0438\u0441\u044b\u043b\u0430\u0442\u044c HTML. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043d\u0443\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c EJS (\u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u0439 JavaScript). EJS \u2014 \u044d\u0442\u043e \u044f\u0437\u044b\u043a \u0448\u0430\u0431\u043b\u043e\u043d\u043e\u0432.<\/p>\n<p>\u0427\u0442\u043e\u0431\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c EJS \u0432 Express, \u0432\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0432\u0430\u0448 \u0448\u0430\u0431\u043b\u043e\u043d\u0438\u0437\u0430\u0442\u043e\u0440. \u0414\u043b\u044f \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0434\u043e\u0431\u0430\u0432\u044c\u0442\u0435 \u044d\u0442\u0443 \u0441\u0442\u0440\u043e\u043a\u0443 \u043a\u043e\u0434\u0430 \u0432 \u0444\u0430\u0439\u043b server.js.<\/p>\n<pre><code class=\"javascript\">app.set(\u2018view engine\u2019, \u2018ejs\u2019)<\/code><\/pre>\n<p>\u0414\u043e\u0441\u0442\u0443\u043f \u043a EJS \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0432 \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0435 views. \u0422\u0435\u043f\u0435\u0440\u044c \u0441\u043e\u0437\u0434\u0430\u0439\u0442\u0435 \u043d\u043e\u0432\u0443\u044e \u043f\u0430\u043f\u043a\u0443 views \u0432 \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0435. \u0412 \u044d\u0442\u043e\u0439 \u043f\u0430\u043f\u043a\u0435 \u0434\u043e\u0431\u0430\u0432\u044c\u0442\u0435 \u0444\u0430\u0439\u043b \u0441 \u0438\u043c\u0435\u043d\u0435\u043c room.ejs. \u041f\u043e\u043a\u0430 \u0447\u0442\u043e \u0434\u0443\u043c\u0430\u0439\u0442\u0435 \u043e \u043d\u0430\u0448\u0435\u043c \u0444\u0430\u0439\u043b\u0435 room.ejs \u043a\u0430\u043a \u043e HTML-\u0444\u0430\u0439\u043b\u0435.<\/p>\n<p>\u0412\u043e\u0442 \u043a\u0430\u043a \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0432\u0430\u0448\u0430 \u0444\u0430\u0439\u043b\u043e\u0432\u0430\u044f \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430:<\/p>\n<pre><code>|-- video-chat-app    |-- views       |-- room.ejs    |-- package.json    |-- server.js<\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0434\u043e\u0431\u0430\u0432\u044c\u0442\u0435 HTML-\u043a\u043e\u0434 \u0432 \u0444\u0430\u0439\u043b room.ejs.<\/p>\n<p><iframe id=\"606c4b0a388fa3867a8ff3f2\" src=\"https:\/\/embedd.srv.habr.com\/iframe\/606c4b0a388fa3867a8ff3f2\" class=\"embed_video embed__content\" allowfullscreen=\"true\"><\/iframe><\/p>\n<p>\u041a\u0430\u043a \u0442\u043e\u043b\u044c\u043a\u043e \u0432\u044b \u0441\u043a\u043e\u043f\u0438\u0440\u0443\u0435\u0442\u0435 \u043f\u0440\u0438\u0432\u0435\u0434\u0451\u043d\u043d\u044b\u0439 \u0432\u044b\u0448\u0435 \u043a\u043e\u0434, \u043d\u0443\u0436\u043d\u043e \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043f\u043e\u043c\u0435\u043d\u044f\u0442\u044c app.js:<\/p>\n<pre><code class=\"javascript\">app.get(\u2018\/\u2019, function (req, res) {  \/\/ OLD CODE  res.status(200).send(\"Hello World\"); })<\/code><\/pre>\n<p>\u0412\u044b\u0448\u0435 \u043f\u0440\u0438\u0432\u0435\u0434\u0451\u043d \u0441\u0442\u0430\u0440\u044b\u0439 \u043a\u043e\u0434, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0432\u044b \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442\u0435 \u043a\u043b\u0438\u0435\u043d\u0442\u0443 \u0442\u0435\u043a\u0441\u0442 \u00abHello World!\u00bb. \u0412\u043c\u0435\u0441\u0442\u043e \u044d\u0442\u043e\u0433\u043e \u0432\u044b \u0445\u043e\u0442\u0438\u0442\u0435 \u043e\u0442\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u0444\u0430\u0439\u043b room.ejs:<\/p>\n<pre><code class=\"javascript\">app.get(\u2018\/\u2019, function (req, res) {  \/\/ NEW CODE  res.render(\u2018room\u2019); })<\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043e\u0442\u043a\u0440\u043e\u0439\u0442\u0435 \u0431\u0440\u0430\u0443\u0437\u0435\u0440 \u0438 \u043f\u0435\u0440\u0435\u0439\u0434\u0438\u0442\u0435 \u043f\u043e \u0430\u0434\u0440\u0435\u0441\u0443: localhost:3030, \u0438 \u0432\u044b \u0443\u0432\u0438\u0434\u0438\u0442\u0435, \u0447\u0442\u043e \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0435\u0442\u0441\u044f \u0444\u0430\u0439\u043b room.ejs!<\/p>\n<figure class=\"\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/b97\/4a7\/77f\/b974a777ff79533b86bdb8c5d525073c.png\" width=\"498\" height=\"209\"><figcaption><\/figcaption><\/figure>\n<h3>\u0414\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 CSS<\/h3>\n<p>\u0412\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u043d\u0435 \u043e\u0447\u0435\u043d\u044c \u0445\u043e\u0440\u043e\u0448\u043e, \u043f\u0440\u0430\u0432\u0434\u0430? \u042d\u0442\u043e \u043f\u043e\u0442\u043e\u043c\u0443, \u0447\u0442\u043e \u0432 \u0432\u0430\u0448\u0435\u043c \u043f\u0440\u043e\u0435\u043a\u0442\u0435 \u043d\u0435\u0442 \u0441\u0442\u0438\u043b\u0435\u0439. \u0418\u0442\u0430\u043a, \u0434\u043e\u0431\u0430\u0432\u044c\u0442\u0435 \u043d\u0435\u043c\u043d\u043e\u0433\u043e CSS.<\/p>\n<p>\u041d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043d\u043e\u0432\u0443\u044e \u043f\u0430\u043f\u043a\u0443 \u0432 \u043f\u0440\u043e\u0435\u043a\u0442 \u043f\u043e\u0434 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435\u043c public. \u0412 \u044d\u0442\u043e\u0439 \u043f\u0430\u043f\u043a\u0435 \u0441\u043e\u0437\u0434\u0430\u0439\u0442\u0435 \u0444\u0430\u0439\u043b\u044b style.css \u0438 script.js. \u0412\u043e\u0442 \u0432\u0430\u0448\u0430 \u043d\u043e\u0432\u0430\u044f \u0444\u0430\u0439\u043b\u043e\u0432\u0430\u044f \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430:<\/p>\n<pre><code>|-- weather-app    |-- views       |-- index.ejs    |-- public       |-- style.css       |-- script.js    |-- package.json    |-- server.js<\/code><\/pre>\n<p>Express \u043d\u0435 \u0434\u0430\u0451\u0442 \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a \u044d\u0442\u043e\u043c\u0443 \u0444\u0430\u0439\u043b\u0443 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0432\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u043e\u0442\u043a\u0440\u044b\u0442\u044c \u0435\u0433\u043e \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u0441\u0442\u0440\u043e\u043a\u0438 \u043a\u043e\u0434\u0430:<\/p>\n<pre><code class=\"javascript\">app.use(express.static(\u2018public\u2019));<\/code><\/pre>\n<p>\u042d\u0442\u043e\u0442 \u043a\u043e\u0434 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0432\u0430\u043c \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0434\u043e\u0441\u0442\u0443\u043f \u043a\u043e \u0432\u0441\u0435\u043c \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u043c \u0444\u0430\u0439\u043b\u0430\u043c \u0432 \u043f\u0430\u043f\u043a\u0435 \u201cpublic\u201d. \u041d\u0430\u043a\u043e\u043d\u0435\u0446, \u0432\u0430\u043c \u043d\u0443\u0436\u0435\u043d CSS. \u041f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u044d\u0442\u043e \u043d\u0435 \u043a\u0443\u0440\u0441 \u043f\u043e CSS, \u044f \u043d\u0435 \u0431\u0443\u0434\u0443 \u0432\u0434\u0430\u0432\u0430\u0442\u044c\u0441\u044f \u0432 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e\u0441\u0442\u0438, \u043d\u043e \u0435\u0441\u043b\u0438 \u0432\u044b \u0445\u043e\u0442\u0438\u0442\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043c\u043e\u0438 \u0441\u0442\u0438\u043b\u0438, \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0441\u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0438\u0445 <a href=\"https:\/\/github.com\/itstaranarora\/video-chat-v1\/blob\/master\/public\/style.css\"><u>\u043e\u0442\u0441\u044e\u0434\u0430<\/u><\/a>.<\/p>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0442\u043e\u0433\u043e \u043a\u0430\u043a \u0432\u044b \u0434\u043e\u0431\u0430\u0432\u0438\u043b\u0438 CSS, \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u043e\u0441\u0435\u0442\u0438\u0442\u044c: localhost:3030. \u0412\u044b \u0437\u0430\u043c\u0435\u0442\u0438\u0442\u0435, \u0447\u0442\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043b\u0443\u0447\u0448\u0435.<\/p>\n<h3>\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u043a\u043e\u043c\u043d\u0430\u0442<\/h3>\n<p>\u041a \u043d\u0430\u0441\u0442\u043e\u044f\u0449\u0435\u043c\u0443 \u043c\u043e\u043c\u0435\u043d\u0442\u0443 \u0432\u0430\u0448 \u0444\u0430\u0439\u043b server.js \u0434\u043e\u043b\u0436\u0435\u043d \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u0442\u0430\u043a:<\/p>\n<p><iframe id=\"606c4b2f388fa3867a8ff3f3\" src=\"https:\/\/embedd.srv.habr.com\/iframe\/606c4b2f388fa3867a8ff3f3\" class=\"embed_video embed__content\" allowfullscreen=\"true\"><\/iframe><\/p>\n<p>\u0423 \u0432\u0430\u0441 \u0435\u0441\u0442\u044c \u043e\u0434\u0438\u043d GET-\u0440\u043e\u0443\u0442 \u0438 \u0437\u0430\u043f\u0443\u0441\u043a \u0441\u0435\u0440\u0432\u0435\u0440\u0430. \u041e\u0434\u043d\u0430\u043a\u043e, \u0447\u0442\u043e\u0431\u044b \u0432\u0430\u0448\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u043b\u043e, \u043d\u0443\u0436\u043d\u043e \u0432\u0441\u044f\u043a\u0438\u0439 \u0440\u0430\u0437, \u043a\u043e\u0433\u0434\u0430 \u043d\u043e\u0432\u044b\u0439 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u043f\u043e\u0441\u0435\u0449\u0430\u0435\u0442 \u0432\u0430\u0448 \u0440\u043e\u0443\u0442 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e, \u043f\u0435\u0440\u0435\u043d\u0430\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u0435\u0433\u043e \u043d\u0430 \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u0439 URL-\u0430\u0434\u0440\u0435\u0441. \u0421\u043b\u0435\u0434\u0443\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 uuid \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e\u0433\u043e \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u043e\u0433\u043e URL-\u0430\u0434\u0440\u0435\u0441\u0430 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0439 \u043a\u043e\u043c\u043d\u0430\u0442\u044b.<\/p>\n<p>UUID \u2014 \u044d\u0442\u043e \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 javascript, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0432\u0430\u043c \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u0435 \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u044b. \u0412 \u0432\u0430\u0448\u0435\u043c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438 \u0432\u044b \u0431\u0443\u0434\u0435\u0442\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c uuid \u0432\u0435\u0440\u0441\u0438\u0438 4 \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u043e\u0433\u043e URL. \u041d\u043e \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u0438\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u0443\u0439\u0442\u0435 uuid \u0432 server.js.&nbsp;<\/p>\n<pre><code class=\"javascript\">const { v4: uuidv4 } = require(\"uuid\");<\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0443\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <a href=\"https:\/\/www.npmjs.com\/package\/uuid\"><u>uuid<\/u><\/a> \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e\u0433\u043e \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u0430 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0439 \u043a\u043e\u043c\u043d\u0430\u0442\u044b \u0438 \u043f\u0435\u0440\u0435\u043d\u0430\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0432 \u044d\u0442\u0443 \u043a\u043e\u043c\u043d\u0430\u0442\u0443.<\/p>\n<pre><code class=\"javascript\">app.get(\u201c\/\u201d, (req, res) =&gt; {     res.redirect(`\/${uuidv4()}`); });<\/code><\/pre>\n<p>\u0418, \u043f\u0440\u0435\u0436\u0434\u0435 \u0447\u0435\u043c \u0432\u044b \u043f\u0440\u043e\u0442\u0435\u0441\u0442\u0438\u0440\u0443\u0435\u0442\u0435 \u044d\u0442\u043e, \u044f \u0442\u0430\u043a\u0436\u0435 \u0445\u043e\u0442\u0435\u043b \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0443 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0439 \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u043e\u0439 \u043a\u043e\u043c\u043d\u0430\u0442\u044b, \u0438 \u0432\u044b \u043f\u0435\u0440\u0435\u0434\u0430\u0434\u0438\u0442\u0435 \u0442\u0435\u043a\u0443\u0449\u0438\u0439 URL \u044d\u0442\u043e\u0439 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0435.<\/p>\n<pre><code class=\"javascript\">app.get(\u201c\/:room\u201d, (req, res) =&gt; {     res.render(\u201croom\u201d, { roomId: req.param.room }); });<\/code><\/pre>\n<p>\u0412\u044b \u043f\u0435\u0440\u0435\u0434\u0430\u043b\u0438 roomId \u0432 room.ejs \u043d\u0430 \u044d\u0442\u043e\u043c \u0437\u0430\u043a\u043e\u043d\u0447\u0438\u043b\u0438 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0443 \u0432\u0430\u0448\u0438\u0445 \u043a\u043e\u043c\u043d\u0430\u0442. \u0410 \u0442\u0435\u043f\u0435\u0440\u044c, \u0435\u0441\u043b\u0438 \u0432\u044b \u043f\u043e\u0441\u0435\u0442\u0438\u0442\u0435 localhost:3030, \u0432\u044b \u0431\u0443\u0434\u0435\u0442\u0435 \u043f\u0435\u0440\u0435\u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u044b \u043d\u0430 \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u0439 URL.<\/p>\n<figure class=\"\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/5a9\/26c\/d49\/5a926cd49c7e559e4498401d52c86daf.png\" width=\"1078\" height=\"174\"><figcaption><\/figcaption><\/figure>\n<h3>\u0414\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0432\u0438\u0434\u0435\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f<\/h3>\n<p>\u0412\u044b \u0431\u0443\u0434\u0435\u0442\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 \u0444\u0430\u0439\u043b\u043e\u043c script.js, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432\u044b \u0441\u043e\u0437\u0434\u0430\u043b\u0438 \u0440\u0430\u043d\u0435\u0435. script.js \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u044c \u0432\u0435\u0441\u044c \u043a\u043b\u0438\u0435\u043d\u0442\u0441\u043a\u0438\u0439 \u043a\u043e\u0434 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f.<\/p>\n<p>\u0418\u0442\u0430\u043a, \u0432\u043e\u0442 \u0447\u0442\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c: \u043d\u0443\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0432\u0438\u0434\u0435\u043e\u043f\u043e\u0442\u043e\u043a, \u0430 \u0437\u0430\u0442\u0435\u043c \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u044d\u0442\u043e\u0442 \u043f\u043e\u0442\u043e\u043a \u0432 \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u0432\u0438\u0434\u0435\u043e.<\/p>\n<pre><code class=\"javascript\">let myVideoStream; const videoGrid = document.getElementById(\"video-grid\"); const myVideo = document.createElement(\"video\"); myVideo.muted = true; navigator.mediaDevices.getUserMedia({     audio: true,     video: true, }) .then((stream) =&gt; {     myVideoStream = stream;     addVideoStream(myVideo, stream); });<\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0441\u043e\u0437\u0434\u0430\u0439\u0442\u0435\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u044e addVideoStream, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0434\u043e\u0431\u0430\u0432\u0438\u0442 \u043f\u043e\u0442\u043e\u043a \u043a \u0432\u0438\u0434\u0435\u043e\u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0443.<\/p>\n<pre><code class=\"javascript\">const addVideoStream = (video, stream) =&gt; {     video.srcObject = stream;     video.addEventListener(\"loadedmetadata\", () =&gt; {        video.play();        videoGrid.append(video);     }); };<\/code><\/pre>\n<p>\u042d\u0442\u043e\u0442 \u043a\u043e\u0434 \u0434\u043e\u0431\u0430\u0432\u0438\u0442 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0439 \u043f\u043e\u0442\u043e\u043a \u043a \u0432\u0438\u0434\u0435\u043e\u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0443. \u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u044d\u0442\u043e, \u043f\u043e\u0441\u0435\u0442\u0438\u0432 localhost:3030, \u0438 \u0432\u044b \u0443\u0432\u0438\u0434\u0438\u0442\u0435 \u0432\u0441\u043f\u043b\u044b\u0432\u0430\u044e\u0449\u0435\u0435 \u043e\u043a\u043d\u043e \u0441 \u0432\u0438\u0434\u0435\u043e&nbsp;<\/p>\n<figure class=\"\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/677\/0f6\/1b1\/6770f61b1ee99ed5965a63e1facef0f0.png\" width=\"1600\" height=\"794\"><figcaption><\/figcaption><\/figure>\n<h3>\u0414\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u0440\u0430\u0437\u0440\u0435\u0448\u0438\u0442\u044c \u0434\u0440\u0443\u0433\u0438\u043c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f\u043c \u0442\u0440\u0430\u043d\u0441\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u0432\u043e\u0438 \u0432\u0438\u0434\u0435\u043e \u0432 \u043f\u043e\u0442\u043e\u043a\u043e\u0432\u043e\u043c \u0440\u0435\u0436\u0438\u043c\u0435.<\/h3>\n<p>\u041f\u0440\u0438\u0448\u043b\u043e \u0432\u0440\u0435\u043c\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c Socket.io \u0438 PeerJS. \u0414\u043b\u044f \u0442\u0435\u0445, \u043a\u0442\u043e \u043d\u0435 \u0437\u043d\u0430\u0435\u0442, Socket.io \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u0441\u0435\u0440\u0432\u0435\u0440\u0443 \u0438 \u043a\u043b\u0438\u0435\u043d\u0442\u0443 \u0432 \u0440\u0435\u0436\u0438\u043c\u0435 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438.&nbsp; PeerJS \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0442 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c WebRTC.<\/p>\n<p>\u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u0438\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u0443\u0439\u0442\u0435 socket.io \u0438 peerjs \u0432 server.js \u0438 \u043f\u0440\u043e\u0441\u043b\u0443\u0448\u0430\u0439\u0442\u0435 \u0441\u043e\u0431\u044b\u0442\u0438\u0435 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f.<\/p>\n<pre><code class=\"javascript\">\/\/ server.js const express = require(\u201cexpress\u201d); const app = express(); const server = require(\u201chttp\u201d).Server(app); const { v4: uuidv4 } = require(\u201cuuid\u201d); app.set(\u201cview engine\u201d, \u201cejs\u201d); const io = require(\u201csocket.io\u201d)(server); const { ExpressPeerServer } = require(\u201cpeer\u201d); const peerServer = ExpressPeerServer(server, {     debug: true, }); app.use(\u201c\/peerjs\u201d, peerServer); app.use(express.static(\u201cpublic\u201d)); app.get(\u201c\/\u201d, (req, res) =&gt; {     res.redirect(`\/${uuidv4()}`); }); app.get(\u201c\/:room\u201d, (req, res) =&gt; {     res.render(\u201croom\u201d, { roomId: req.param.room }); }); io.on(\u201cconnection\u201d, (socket) =&gt; {     socket.on(\u201cjoin-room\u201d, (roomId, userId) =&gt; {     socket.join(roomId);     socket.to(roomId).broadcast.emit(\u201cuser-connected\u201d, userId);     }); }); server.listen(3030);<\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0432\u0430\u0448 \u0441\u0435\u0440\u0432\u0435\u0440 \u043f\u0440\u043e\u0441\u043b\u0443\u0448\u0438\u0432\u0430\u0435\u0442 \u0441\u043e\u0431\u044b\u0442\u0438\u0435 \u043f\u0440\u0438\u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f \u043a \u043a\u043e\u043c\u043d\u0430\u0442\u0435. \u0414\u0430\u043b\u0435\u0435 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u0442\u0435 \u0432\u0430\u0448 script.js.<\/p>\n<pre><code class=\"javascript\">\/\/ public\/script.js const socket = io(\u201c\/\u201d); const videoGrid = document.getElementById(\u201cvideo-grid\u201d); const myVideo = document.createElement(\u201cvideo\u201d); myVideo.muted = true; var peer = new Peer(undefined, {   path: \u201c\/peerjs\u201d,   host: \u201c\/\u201d,   port: \u201c3030\u201d, }); let myVideoStream; navigator.mediaDevices   .getUserMedia({   audio: true,   video: true, }) .then((stream) =&gt; {   myVideoStream = stream;   addVideoStream(myVideo, stream);   peer.on(\u201ccall\u201d, (call) =&gt; {     call.answer(stream);     const video = document.createElement(\u201cvideo\u201d);     call.on(\u201cstream\u201d, (userVideoStream) =&gt; {       addVideoStream(video, userVideoStream);       });     });   socket.on(\u201cuser-connected\u201d, (userId) =&gt; {       connectToNewUser(userId, stream);   }); }); const connectToNewUser = (userId, stream) =&gt; {   const call = peer.call(userId, stream);   const video = document.createElement(\u201cvideo\u201d);   call.on(\u201cstream\u201d, (userVideoStream) =&gt; {       addVideoStream(video, userVideoStream);   }); }; peer.on(\u201copen\u201d, (id) =&gt; {     socket.emit(\u201cjoin-room\u201d, ROOM_ID, id); }); const addVideoStream = (video, stream) =&gt; {   video.srcObject = stream;   video.addEventListener(\u201cloadedmetadata\u201d, () =&gt; {     video.play();     videoGrid.append(video);   }); };<\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c, \u0435\u0441\u043b\u0438 \u0432 \u043a\u043e\u043c\u043d\u0430\u0442\u0443 \u0432\u043e\u0439\u0434\u0451\u0442 \u043d\u043e\u0432\u044b\u0439 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c, \u0432\u044b \u0443\u0432\u0438\u0434\u0438\u0442\u0435 \u0435\u0433\u043e \u0432\u0438\u0434\u0435\u043e.<\/p>\n<h3>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u043e\u0433\u043e \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430<\/h3>\n<p>\u0421 \u0432\u0438\u0434\u0435\u043e\u0447\u0430\u0441\u0442\u044c\u044e \u0437\u0430\u043a\u043e\u043d\u0447\u0438\u043b\u0438. \u0410 \u0442\u0435\u043f\u0435\u0440\u044c \u0437\u0430\u0439\u043c\u0438\u0442\u0435\u0441\u044c \u0441\u0442\u0438\u043b\u0438\u0437\u0430\u0446\u0438\u0435\u0439. \u041d\u043e \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u0434\u043e\u0431\u0430\u0432\u044c\u0442\u0435 \u043a\u043e\u043d\u0442\u0435\u043d\u0442 \u0432 \u0444\u0430\u0439\u043b room.ejs. (\u0414\u043e\u0431\u0430\u0432\u044c\u0442\u0435 CDN font-awesome \u0432\u043d\u0443\u0442\u0440\u0438 \u0442\u0435\u0433\u0430 head.)<\/p>\n<pre><code>\/\/ views\/room.ejs &lt;body&gt;   &lt;div class=\"header\"&gt;     &lt;div class=\"logo\"&gt;       &lt;h3&gt;Video Chat&lt;\/h2&gt;     &lt;\/div&gt;   &lt;\/div&gt;   &lt;div class=\"main\"&gt;     &lt;div class=\"main__left\"&gt;       &lt;div class=\"videos__group\"&gt;         &lt;div id=\"video-grid\"&gt;&lt;\/div&gt;       &lt;\/div&gt;       &lt;div class=\"options\"&gt;         &lt;div class=\"options__left\"&gt;           &lt;div class=\"options__button\"&gt;             &lt;i class=\"fa fa-video-camera\" aria-hidden=\"true\"&gt;&lt;\/i&gt;           &lt;\/div&gt;         &lt;div class=\"options__button\"&gt;             &lt;i class=\"fa fa-microphone\" aria-hidden=\"true\"&gt;&lt;\/i&gt;         &lt;\/div&gt;        &lt;\/div&gt;        &lt;div class=\"options__right\"&gt;          &lt;div class=\"options__button background__red\"&gt;            &lt;i class=\"fa fa-phone\" aria-hidden=\"true\"&gt;&lt;\/i&gt;          &lt;\/div&gt;        &lt;\/div&gt;      &lt;\/div&gt;     &lt;\/div&gt;     &lt;div class=\"main__right\"&gt;       &lt;div class=\"main__chat_window\"&gt;         &lt;ul class=\"messages\"&gt;&lt;\/ul&gt;      &lt;\/div&gt;      &lt;div class=\"main__message_container\"&gt;        &lt;input id=\"chat_message\" type=\"text\" placeholder=\"Type message here...\"&gt;        &lt;div class=\"options__button\"&gt;          &lt;i class=\"fa fa-plus\" aria-hidden=\"true\"&gt;&lt;\/i&gt;        &lt;\/div&gt;      &lt;\/div&gt;     &lt;\/div&gt;   &lt;\/div&gt; &lt;\/body&gt;<\/code><\/pre>\n<p>\u0417\u0430\u0442\u0435\u043c \u043e\u0442\u043a\u0440\u043e\u0439\u0442\u0435 \u0444\u0430\u0439\u043b style.css \u0438 \u0434\u043e\u0431\u0430\u0432\u044c\u0442\u0435 \u043d\u0435\u043c\u043d\u043e\u0433\u043e CSS.<\/p>\n<pre><code class=\"css\">@import url(\u201chttps:\/\/fonts.googleapis.com\/css2?family=Poppins:wght@400;500;600&amp;display=swap\"); :root {   \u2014 main-darklg: #1d2635;   \u2014 main-dark: #161d29;   \u2014 primary-color: #2f80ec;   \u2014 main-light: #eeeeee;   font-family: \u201cPoppins\u201d, sans-serif; } * {   margin: 0;   padding: 0; } .header {   display: flex;   justify-content: center;   align-items: center;   height: 8vh;   width: 100%;   background-color: var( \u2014 main-darklg); } .logo &gt; h3 {     color: var( \u2014 main-light); } .main {   overflow: hidden;   height: 92vh;   display: flex; } .main__left {   flex: 0.7;   display: flex;   flex-direction: column; } .videos__group {   flex-grow: 1;   display: flex;   justify-content: center;   align-items: center;   padding: 1rem;   background-color: var( \u2014 main-dark); } video {   height: 300px;   border-radius: 1rem;   margin: 0.5rem;   width: 400px;   object-fit: cover;   transform: rotateY(180deg);   -webkit-transform: rotateY(180deg);   -moz-transform: rotateY(180deg); } .options {   padding: 1rem;   display: flex;   background-color: var( \u2014 main-darklg); } .options__left {     display: flex; } .options__right {     margin-left: auto; } .options__button {   display: flex;   justify-content: center;   align-items: center;   background-color: var( \u2014 primary-color);   height: 50px;   border-radius: 5px;   color: var( \u2014 main-light);   font-size: 1.2rem;   width: 50px;   margin: 0 0.5rem; } .background__red {     background-color: #f6484a; } .main__right { flex: 0.3;     background-color: #242f41; } .main__chat_window {     flex-grow: 1; } .main__message_container {   padding: 1rem;   display: flex;   align-items: center;   justify-content: center; } .main__message_container &gt; input {   height: 50px;   flex: 1;   border-radius: 5px;   padding-left: 20px;   border: none; } #video-grid {   display: flex;   justify-content: center;   flex-wrap: wrap; }<\/code><\/pre>\n<p>\u0412\u043e\u0442 \u0438 \u0432\u0441\u0451! \u041f\u043e\u0437\u0434\u0440\u0430\u0432\u043b\u044f\u0435\u043c, \u0432\u044b \u0443\u0441\u043f\u0435\u0448\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u043b\u0438 \u0432\u0438\u0434\u0435\u043e\u0447\u0430\u0442! \u0422\u0435\u043f\u0435\u0440\u044c \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0440\u0430\u0437\u0432\u0435\u0440\u043d\u0443\u0442\u044c \u0435\u0433\u043e \u043d\u0430 Heroku \u0438 \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u044c \u0435\u0433\u043e \u0432\u0441\u0435\u043c\u0443 \u043c\u0438\u0440\u0443. <a href=\"https:\/\/video-chat-app-v1.herokuapp.com\/\"><u>\u0414\u0435\u043c\u043e<\/u><\/a> \u0438 <a href=\"https:\/\/github.com\/itstaranarora\/video-chat-v1\"><u>\u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434<\/u><\/a>. <\/p>\n<p>\u042d\u0442\u043e \u043b\u0438\u0448\u044c \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u043f\u0440\u0438\u043c\u0435\u0440 \u0442\u043e\u0433\u043e, \u043a\u0430\u043a\u0438\u0435 \u0432\u0435\u0449\u0438 \u043c\u043e\u0436\u0435\u0442 \u0434\u0435\u043b\u0430\u0442\u044c \u0432\u0435\u0431-\u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a, \u043f\u0440\u0438\u0447\u0435\u043c \u0432 \u043e\u0434\u0438\u043d\u043e\u0447\u043a\u0443. \u0421\u0434\u0435\u043b\u0430\u0442\u044c just for fun \u044d\u043a\u0441\u043f\u043e\u0440\u0442 \u043c\u0443\u0437\u044b\u043a\u0438 \u0432 Spotify \u0438 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u043e\u0441\u0442\u044c, \u043f\u043e\u043a\u0430 \u043e\u0433\u0440\u043e\u043c\u043d\u0430\u044f \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u044f \u0434\u043e\u043b\u0433\u043e \u0434\u0443\u043c\u0430\u0435\u0442 \u043d\u0430\u0434 \u0440\u0435\u0448\u0435\u043d\u0438\u0435\u043c \u0437\u0430\u0434\u0430\u0447\u0438 \u2014 \u0431\u0435\u0437 \u043f\u0440\u043e\u0431\u043b\u0435\u043c. \u0417\u0430 \u043e\u0434\u0438\u043d \u0432\u0435\u0447\u0435\u0440 \u043d\u0430\u0431\u0440\u043e\u0441\u0430\u0442\u044c \u0438 \u0432\u044b\u043a\u0430\u0442\u0438\u0442\u044c \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0435 \u0434\u043b\u044f \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0430, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0443\u043f\u0440\u043e\u0441\u0442\u0438\u0442 \u0436\u0438\u0437\u043d\u044c \u043c\u0438\u043b\u043b\u0438\u043e\u043d\u0430\u043c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439 \u2014 \u0442\u043e\u0436\u0435 \u043f\u043e \u0441\u0438\u043b\u0430\u043c. \u041d\u0430 \u0447\u0442\u043e \u0435\u0449\u0435 \u0441\u043f\u043e\u0441\u043e\u0431\u043d\u0430 \u0432\u0435\u0431-\u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u2014 \u0437\u0430\u0432\u0438\u0441\u0438\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0442 \u0444\u0430\u043d\u0442\u0430\u0437\u0438\u0438 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442\u0430. \u041f\u0440\u0438\u0445\u043e\u0434\u0438\u0442\u0435 \u0443\u0447\u0438\u0442\u044c\u0441\u044f, \u0447\u0442\u043e\u0431\u044b \u043e\u0441\u0432\u043e\u0438\u0442\u044c <a href=\"https:\/\/skillfactory.ru\/webdev?utm_source=infopartners&amp;utm_medium=habr&amp;utm_campaign=habr_WEBDEV&amp;utm_term=regular&amp;utm_content=060421\">\u0434\u0437\u044e\u0446\u0443 \u0432\u0435\u0431-\u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438<\/a> \u0438 \u0441\u0442\u0430\u0442\u044c \u043d\u0430\u0441\u0442\u043e\u044f\u0449\u0438\u043c \u0441\u0430\u043c\u0443\u0440\u0430\u0435\u043c \u0438\u043d\u0442\u0435\u0440\u043d\u0435\u0442\u0430. <\/p>\n<figure class=\"\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/b1f\/07e\/1d3\/b1f07e1d329ce5fbd4e4a336e33faa52.png\" width=\"1000\" height=\"200\"><figcaption><\/figcaption><\/figure>\n<p><a href=\"https:\/\/skillfactory.ru\/courses\/?utm_source=infopartners&amp;utm_medium=habr&amp;utm_campaign=habr_ALLCOURSES&amp;utm_term=regular&amp;utm_content=050421\">\u0423\u0437\u043d\u0430\u0439\u0442\u0435<\/a>, \u043a\u0430\u043a \u043f\u0440\u043e\u043a\u0430\u0447\u0430\u0442\u044c\u0441\u044f \u0432 \u0434\u0440\u0443\u0433\u0438\u0445 \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u044f\u0445 \u0438\u043b\u0438 \u043e\u0441\u0432\u043e\u0438\u0442\u044c \u0438\u0445 \u0441 \u043d\u0443\u043b\u044f:<\/p>\n<ul>\n<li>\n<p><a href=\"https:\/\/skillfactory.ru\/python-fullstack-web-developer?utm_source=infopartners&amp;utm_medium=habr&amp;utm_campaign=habr_FPW&amp;utm_term=regular&amp;utm_content=060421\">\u041f\u0440\u043e\u0444\u0435\u0441\u0441\u0438\u044f Fullstack-\u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u043d\u0430 Python<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/skillfactory.ru\/cplus?utm_source=infopartners&amp;utm_medium=habr&amp;utm_campaign=habr_CPLUS&amp;utm_term=regular&amp;utm_content=060421\">\u041f\u0440\u043e\u0444\u0435\u0441\u0441\u0438\u044f C++ \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/skillfactory.ru\/java?utm_source=infopartners&amp;utm_medium=habr&amp;utm_campaign=habr_JAVA&amp;utm_term=regular&amp;utm_content=060421\">\u041f\u0440\u043e\u0444\u0435\u0441\u0441\u0438\u044f Java-\u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/skillfactory.ru\/python-for-web-developers?utm_source=infopartners&amp;utm_medium=habr&amp;utm_campaign=habr_PWS&amp;utm_term=regular&amp;utm_content=060421\">\u041a\u0443\u0440\u0441 &#171;Python \u0434\u043b\u044f \u0432\u0435\u0431-\u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438&#187;<\/a><\/p>\n<\/li>\n<\/ul>\n<details class=\"spoiler\">\n<summary>\u0414\u0440\u0443\u0433\u0438\u0435 \u043f\u0440\u043e\u0444\u0435\u0441\u0441\u0438\u0438 \u0438 \u043a\u0443\u0440\u0441\u044b<\/summary>\n<div class=\"spoiler__content\">\n<p><strong>\u041f\u0420\u041e\u0424\u0415\u0421\u0421\u0418\u0418<\/strong><\/p>\n<ul>\n<li>\n<p><a href=\"https:\/\/skillfactory.ru\/dstpro?utm_source=infopartners&amp;utm_medium=habr&amp;utm_campaign=habr_DSPR&amp;utm_term=regular&amp;utm_content=060421\">\u041f\u0440\u043e\u0444\u0435\u0441\u0441\u0438\u044f Data Scientist<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/skillfactory.ru\/dataanalystpro?utm_source=infopartners&amp;utm_medium=habr&amp;utm_campaign=habr_DAPR&amp;utm_term=regular&amp;utm_content=060421\">\u041f\u0440\u043e\u0444\u0435\u0441\u0441\u0438\u044f Data Analyst<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/skillfactory.ru\/java-qa-engineer?utm_source=infopartners&amp;utm_medium=habr&amp;utm_campaign=habr_QAJA&amp;utm_term=regular&amp;utm_content=060421\">\u041f\u0440\u043e\u0444\u0435\u0441\u0441\u0438\u044f QA-\u0438\u043d\u0436\u0435\u043d\u0435\u0440 \u043d\u0430 JAVA<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/skillfactory.ru\/frontend?utm_source=infopartners&amp;utm_medium=habr&amp;utm_campaign=habr_FR&amp;utm_term=regular&amp;utm_content=060421\">\u041f\u0440\u043e\u0444\u0435\u0441\u0441\u0438\u044f Frontend-\u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/skillfactory.ru\/cybersecurity?utm_source=infopartners&amp;utm_medium=habr&amp;utm_campaign=habr_HACKER&amp;utm_term=regular&amp;utm_content=060421\">\u041f\u0440\u043e\u0444\u0435\u0441\u0441\u0438\u044f \u042d\u0442\u0438\u0447\u043d\u044b\u0439 \u0445\u0430\u043a\u0435\u0440<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/skillfactory.ru\/cplus?utm_source=infopartners&amp;utm_medium=habr&amp;utm_campaign=habr_CPLUS&amp;utm_term=regular&amp;utm_content=060421\">\u041f\u0440\u043e\u0444\u0435\u0441\u0441\u0438\u044f C++ \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/skillfactory.ru\/game-dev?utm_source=infopartners&amp;utm_medium=habr&amp;utm_campaign=habr_GAMEDEV&amp;utm_term=regular&amp;utm_content=060421\">\u041f\u0440\u043e\u0444\u0435\u0441\u0441\u0438\u044f \u0420\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u0438\u0433\u0440 \u043d\u0430 Unity<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/skillfactory.ru\/webdev?utm_source=infopartners&amp;utm_medium=habr&amp;utm_campaign=habr_WEBDEV&amp;utm_term=regular&amp;utm_content=060421\">\u041f\u0440\u043e\u0444\u0435\u0441\u0441\u0438\u044f \u0412\u0435\u0431-\u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/skillfactory.ru\/iosdev?utm_source=infopartners&amp;utm_medium=habr&amp;utm_campaign=habr_IOSDEV&amp;utm_term=regular&amp;utm_content=060421\">\u041f\u0440\u043e\u0444\u0435\u0441\u0441\u0438\u044f iOS-\u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u0441 \u043d\u0443\u043b\u044f<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/skillfactory.ru\/android?utm_source=infopartners&amp;utm_medium=habr&amp;utm_campaign=habr_ANDR&amp;utm_term=regular&amp;utm_content=060421\">\u041f\u0440\u043e\u0444\u0435\u0441\u0441\u0438\u044f Android-\u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u0441 \u043d\u0443\u043b\u044f<\/a><\/p>\n<\/li>\n<\/ul>\n<p><strong>\u041a\u0423\u0420\u0421\u042b<\/strong><\/p>\n<ul>\n<li>\n<p><a href=\"https:\/\/skillfactory.ru\/dataengineer?utm_source=infopartners&amp;utm_medium=habr&amp;utm_campaign=habr_DEA&amp;utm_term=regular&amp;utm_content=060421\">\u041a\u0443\u0440\u0441 \u043f\u043e Data Engineering<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/skillfactory.ru\/ml-programma-machine-learning-online?utm_source=infopartners&amp;utm_medium=habr&amp;utm_campaign=habr_ML&amp;utm_term=regular&amp;utm_content=060421\">\u041a\u0443\u0440\u0441 \u043f\u043e Machine Learning<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/skillfactory.ru\/ml-and-dl?utm_source=infopartners&amp;utm_medium=habr&amp;utm_campaign=habr_MLDL&amp;utm_term=regular&amp;utm_content=060421\">\u041a\u0443\u0440\u0441 &#171;Machine Learning \u0438 Deep Learning&#187;<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/skillfactory.ru\/math-stat-for-ds#syllabus?utm_source=infopartners&amp;utm_medium=habr&amp;utm_campaign=habr_MAT&amp;utm_term=regular&amp;utm_content=060421\">\u041a\u0443\u0440\u0441 &#171;\u041c\u0430\u0442\u0435\u043c\u0430\u0442\u0438\u043a\u0430 \u0434\u043b\u044f Data Science&#187;<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/skillfactory.ru\/math_and_ml?utm_source=infopartners&amp;utm_medium=habr&amp;utm_campaign=habr_MATML&amp;utm_term=regular&amp;utm_content=060421\">\u041a\u0443\u0440\u0441 &#171;\u041c\u0430\u0442\u0435\u043c\u0430\u0442\u0438\u043a\u0430 \u0438 Machine Learning \u0434\u043b\u044f Data Science&#187;&nbsp;<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/skillfactory.ru\/python-for-web-developers?utm_source=infopartners&amp;utm_medium=habr&amp;utm_campaign=habr_PWS&amp;utm_term=regular&amp;utm_content=060421\">\u041a\u0443\u0440\u0441 &#171;Python \u0434\u043b\u044f \u0432\u0435\u0431-\u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438&#187;<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/skillfactory.ru\/algo?utm_source=infopartners&amp;utm_medium=habr&amp;utm_campaign=habr_algo&amp;utm_term=regular&amp;utm_content=060421\">\u041a\u0443\u0440\u0441 &#171;\u0410\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u044b \u0438 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b \u0434\u0430\u043d\u043d\u044b\u0445&#187;<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/skillfactory.ru\/analytics?utm_source=infopartners&amp;utm_medium=habr&amp;utm_campaign=habr_SDA&amp;utm_term=regular&amp;utm_content=060421\">\u041a\u0443\u0440\u0441 \u043f\u043e \u0430\u043d\u0430\u043b\u0438\u0442\u0438\u043a\u0435 \u0434\u0430\u043d\u043d\u044b\u0445<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/skillfactory.ru\/devops?utm_source=infopartners&amp;utm_medium=habr&amp;utm_campaign=habr_DEVOPS&amp;utm_term=regular&amp;utm_content=060421\">\u041a\u0443\u0440\u0441 \u043f\u043e DevOps<\/a><\/p>\n<\/li>\n<\/ul>\n<\/div>\n<\/details>\n<\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/company\/skillfactory\/blog\/551008\/\"> https:\/\/habr.com\/ru\/company\/skillfactory\/blog\/551008\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div class=\"post__text post__text_v2\" id=\"post-content-body\">\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p>\u0421\u0435\u0433\u043e\u0434\u043d\u044f, \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u043e \u043a \u0441\u0442\u0430\u0440\u0442\u0443 <a href=\"https:\/\/skillfactory.ru\/webdev?utm_source=infopartners&amp;utm_medium=habr&amp;utm_campaign=habr_WEBDEV&amp;utm_term=regular&amp;utm_content=060421\">\u043d\u043e\u0432\u043e\u0433\u043e \u043f\u043e\u0442\u043e\u043a\u0430 \u043f\u043e \u0432\u0435\u0431-\u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0435,<\/a> \u043f\u043e\u0434\u0435\u043b\u0438\u043c\u0441\u044f \u0441 \u0432\u0430\u043c\u0438 \u0442\u0443\u0442\u043e\u0440\u0438\u0430\u043b\u043e\u043c, \u0438\u0437 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0432\u044b \u0443\u0437\u043d\u0430\u0435\u0442\u0435, \u043a\u0430\u043a \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0432\u0438\u0434\u0435\u043e\u0447\u0430\u0442 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e JavaScript \u0438 NodeJS. \u0422\u0430\u043a\u0436\u0435 \u0432\u044b \u043d\u0430\u0443\u0447\u0438\u0442\u0435\u0441\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c PeerJS, WebRTC \u0438 Socket.io.<\/p>\n<hr>\n<p><a href=\"https:\/\/video-chat-app-v1.herokuapp.com\/\"><u>\u0417\u0434\u0435\u0441\u044c<\/u><\/a> \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0443\u0432\u0438\u0434\u0435\u0442\u044c \u0436\u0438\u0432\u043e\u0439 \u043f\u0440\u0438\u043c\u0435\u0440 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0432\u044b \u0431\u0443\u0434\u0435\u0442\u0435 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c.<\/p>\n<h3>\u041f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0430 \u043a \u043f\u0440\u043e\u0435\u043a\u0442\u0443<\/h3>\n<p>\u0412\u043e\u0442 \u0447\u0442\u043e \u0432\u0430\u043c \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u0441\u044f:<\/p>\n<ul>\n<li>\n<p>NodeJS: \u043f\u043e\u0441\u0435\u0442\u0438\u0442\u0435 \u043e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0439 <a href=\"https:\/\/nodejs.org\/en\/\"><u>\u0432\u0435\u0431-\u0441\u0430\u0439\u0442 Node.js<\/u><\/a>, \u0447\u0442\u043e\u0431\u044b \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044c \u0438 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c Node;<\/p>\n<\/li>\n<li>\n<p>NPM: \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430 NPM \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u043d\u0430 \u0432\u0430\u0448 \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440 \u043f\u0440\u0438 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0435 Node.js.<\/p>\n<\/li>\n<\/ul>\n<h3>\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u043f\u0440\u043e\u0435\u043a\u0442\u0430<\/h3>\n<p>\u0412\u0435\u0441\u044c \u043a\u043e\u0434 \u044d\u0442\u043e\u0433\u043e \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0439\u0442\u0438 \u0432 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0438 GitHub.<\/p>\n<ol>\n<li>\n<p>\u0421\u043e\u0437\u0434\u0430\u0439\u0442\u0435 \u043f\u0443\u0441\u0442\u043e\u0439 \u043a\u0430\u0442\u0430\u043b\u043e\u0433 \u0441 \u0438\u043c\u0435\u043d\u0435\u043c video-chat-app.<\/p>\n<\/li>\n<li>\n<p>\u041e\u0442\u043a\u0440\u043e\u0439\u0442\u0435 \u043a\u043e\u043d\u0441\u043e\u043b\u044c, \u043f\u0435\u0440\u0435\u0439\u0434\u0438\u0442\u0435 \u0432 \u043d\u0430\u0448 \u043d\u043e\u0432\u044b\u0439 \u043a\u0430\u0442\u0430\u043b\u043e\u0433 \u0438 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u0435 npm init.<\/p>\n<\/li>\n<li>\n<p>\u0417\u0430\u043f\u043e\u043b\u043d\u0438\u0442\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u0443\u044e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u0434\u043b\u044f \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043d\u0430\u0448\u0435\u0433\u043e \u043f\u0440\u043e\u0435\u043a\u0442\u0430.<\/p>\n<\/li>\n<li>\n<p>\u0417\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u0435 npm install express ejs socket.io uuid peer. \u041a\u043e\u043c\u0430\u043d\u0434\u0430 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442 \u0432\u0441\u0435 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u044d\u0442\u043e\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f.<\/p>\n<\/li>\n<li>\n<p>\u0410 \u0442\u0430\u043a\u0436\u0435 \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 dev-\u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0435 <a href=\"https:\/\/nodemon.io\/\"><u>Nodemon<\/u><\/a>. \u041d\u0443\u0436\u043d\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c npm install-dev nodemon. \u042d\u0442\u043e \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442 nodemon \u043a\u0430\u043a dev-\u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u044c.<\/p>\n<\/li>\n<li>\n<p>\u0421\u043e\u0437\u0434\u0430\u0439\u0442\u0435 \u0444\u0430\u0439\u043b server.js \u2014 \u0432 \u044d\u0442\u043e\u043c \u0444\u0430\u0439\u043b\u0435 \u0431\u0443\u0434\u0435\u0442 \u0445\u0440\u0430\u043d\u0438\u0442\u044c\u0441\u044f \u0432\u0441\u044f \u0432\u0430\u0448\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u043d\u0430\u044f \u043b\u043e\u0433\u0438\u043a\u0430.<\/p>\n<\/li>\n<\/ol>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c, \u043a\u043e\u0433\u0434\u0430 \u0443 \u0432\u0430\u0441 \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043d \u043d\u0430\u0448 \u043f\u0440\u043e\u0435\u043a\u0442, \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u0440\u0438\u0441\u0442\u0443\u043f\u0438\u0442\u044c \u043a \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f!<\/p>\n<h3>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0441\u0435\u0440\u0432\u0435\u0440\u0430 (\u0441 Express JS)<\/h3>\n<p>\u041f\u0435\u0440\u0432\u043e\u0435, \u0447\u0442\u043e \u0432\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c, \u2014 \u044d\u0442\u043e \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u0432\u0430\u0448 \u0441\u0435\u0440\u0432\u0435\u0440. \u041c\u044b \u0441\u043e\u0431\u0438\u0440\u0430\u0435\u043c\u0441\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e Express. Express \u2014 \u044d\u0442\u043e \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u0438\u0441\u0442\u0438\u0447\u043d\u044b\u0439 \u0432\u0435\u0431-\u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a \u0434\u043b\u044f Node.js. Express \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043e\u0447\u0435\u043d\u044c \u043b\u0435\u0433\u043a\u043e \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0442\u044c \u0432\u0435\u0431-\u0441\u0435\u0440\u0432\u0435\u0440 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e Node.<\/p>\n<p>\u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0448\u0430\u0431\u043b\u043e\u043d\u043d\u044b\u0439 \u0444\u0430\u0439\u043b \u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f Express.<\/p>\n<pre><code class=\"javascript\">\/\/ server.js const express = require(\u201cexpress\u201d); const app = express(); const server = require(\u201chttp\u201d).Server(app); app.get(\u201c\/\u201d, (req, res) =&gt; {     res.status(200).send(\u201cHello World\u201d); }); server.listen(3030);<\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0432\u0430\u0448 \u0441\u0435\u0440\u0432\u0435\u0440 \u0437\u0430\u043f\u0443\u0449\u0435\u043d, \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u0440\u043e\u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0435\u0433\u043e, \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0432:<\/p>\n<pre><code>&gt; nodemon server.js<\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043e\u0442\u043a\u0440\u043e\u0439\u0442\u0435 \u0441\u0432\u043e\u0439 \u0431\u0440\u0430\u0443\u0437\u0435\u0440 \u0438 \u043f\u0435\u0440\u0435\u0439\u0434\u0438\u0442\u0435 \u043f\u043e \u0430\u0434\u0440\u0435\u0441\u0443: localhost:3000, \u0432\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u0443\u0432\u0438\u0434\u0435\u0442\u044c Hello World.<\/p>\n<figure class=\"\"><figcaption><\/figcaption><\/figure>\n<h3>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043f\u0435\u0440\u0432\u043e\u0439 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b<\/h3>\n<p>\u0412\u043c\u0435\u0441\u0442\u043e \u0442\u043e\u0433\u043e \u0447\u0442\u043e\u0431\u044b \u0432\u044b\u0432\u043e\u0434\u0438\u0442\u044c \u0442\u0435\u043a\u0441\u0442, \u043a\u043e\u0433\u0434\u0430 \u043a\u0442\u043e-\u0442\u043e \u043f\u043e\u0441\u0435\u0449\u0430\u0435\u0442 \u0432\u0430\u0448 \u043a\u043e\u0440\u043d\u0435\u0432\u043e\u0439 \u043c\u0430\u0440\u0448\u0440\u0443\u0442, \u0432\u044b \u0445\u043e\u0442\u0435\u043b\u0438 \u0431\u044b \u043f\u0440\u0438\u0441\u044b\u043b\u0430\u0442\u044c HTML. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043d\u0443\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c EJS (\u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u0439 JavaScript). EJS \u2014 \u044d\u0442\u043e \u044f\u0437\u044b\u043a \u0448\u0430\u0431\u043b\u043e\u043d\u043e\u0432.<\/p>\n<p>\u0427\u0442\u043e\u0431\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c EJS \u0432 Express, \u0432\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0432\u0430\u0448 \u0448\u0430\u0431\u043b\u043e\u043d\u0438\u0437\u0430\u0442\u043e\u0440. \u0414\u043b\u044f \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0434\u043e\u0431\u0430\u0432\u044c\u0442\u0435 \u044d\u0442\u0443 \u0441\u0442\u0440\u043e\u043a\u0443 \u043a\u043e\u0434\u0430 \u0432 \u0444\u0430\u0439\u043b server.js.<\/p>\n<pre><code class=\"javascript\">app.set(\u2018view engine\u2019, \u2018ejs\u2019)<\/code><\/pre>\n<p>\u0414\u043e\u0441\u0442\u0443\u043f \u043a EJS \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0432 \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0435 views. \u0422\u0435\u043f\u0435\u0440\u044c \u0441\u043e\u0437\u0434\u0430\u0439\u0442\u0435 \u043d\u043e\u0432\u0443\u044e \u043f\u0430\u043f\u043a\u0443 views \u0432 \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0435. \u0412 \u044d\u0442\u043e\u0439 \u043f\u0430\u043f\u043a\u0435 \u0434\u043e\u0431\u0430\u0432\u044c\u0442\u0435 \u0444\u0430\u0439\u043b \u0441 \u0438\u043c\u0435\u043d\u0435\u043c room.ejs. \u041f\u043e\u043a\u0430 \u0447\u0442\u043e \u0434\u0443\u043c\u0430\u0439\u0442\u0435 \u043e \u043d\u0430\u0448\u0435\u043c \u0444\u0430\u0439\u043b\u0435 room.ejs \u043a\u0430\u043a \u043e HTML-\u0444\u0430\u0439\u043b\u0435.<\/p>\n<p>\u0412\u043e\u0442 \u043a\u0430\u043a \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0432\u0430\u0448\u0430 \u0444\u0430\u0439\u043b\u043e\u0432\u0430\u044f \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430:<\/p>\n<pre><code>|-- video-chat-app    |-- views       |-- room.ejs    |-- package.json    |-- server.js<\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0434\u043e\u0431\u0430\u0432\u044c\u0442\u0435 HTML-\u043a\u043e\u0434 \u0432 \u0444\u0430\u0439\u043b room.ejs.<\/p>\n<p><iframe id=\"606c4b0a388fa3867a8ff3f2\" src=\"https:\/\/embedd.srv.habr.com\/iframe\/606c4b0a388fa3867a8ff3f2\" class=\"embed_video embed__content\" allowfullscreen=\"true\"><\/iframe><\/p>\n<p>\u041a\u0430\u043a \u0442\u043e\u043b\u044c\u043a\u043e \u0432\u044b \u0441\u043a\u043e\u043f\u0438\u0440\u0443\u0435\u0442\u0435 \u043f\u0440\u0438\u0432\u0435\u0434\u0451\u043d\u043d\u044b\u0439 \u0432\u044b\u0448\u0435 \u043a\u043e\u0434, \u043d\u0443\u0436\u043d\u043e \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043f\u043e\u043c\u0435\u043d\u044f\u0442\u044c app.js:<\/p>\n<pre><code class=\"javascript\">app.get(\u2018\/\u2019, function (req, res) {  \/\/ OLD CODE  res.status(200).send(\"Hello World\"); })<\/code><\/pre>\n<p>\u0412\u044b\u0448\u0435 \u043f\u0440\u0438\u0432\u0435\u0434\u0451\u043d \u0441\u0442\u0430\u0440\u044b\u0439 \u043a\u043e\u0434, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0432\u044b \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442\u0435 \u043a\u043b\u0438\u0435\u043d\u0442\u0443 \u0442\u0435\u043a\u0441\u0442 \u00abHello World!\u00bb. \u0412\u043c\u0435\u0441\u0442\u043e \u044d\u0442\u043e\u0433\u043e \u0432\u044b \u0445\u043e\u0442\u0438\u0442\u0435 \u043e\u0442\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u0444\u0430\u0439\u043b room.ejs:<\/p>\n<pre><code class=\"javascript\">app.get(\u2018\/\u2019, function (req, res) {  \/\/ NEW CODE  res.render(\u2018room\u2019); })<\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043e\u0442\u043a\u0440\u043e\u0439\u0442\u0435 \u0431\u0440\u0430\u0443\u0437\u0435\u0440 \u0438 \u043f\u0435\u0440\u0435\u0439\u0434\u0438\u0442\u0435 \u043f\u043e \u0430\u0434\u0440\u0435\u0441\u0443: localhost:3030, \u0438 \u0432\u044b \u0443\u0432\u0438\u0434\u0438\u0442\u0435, \u0447\u0442\u043e \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0435\u0442\u0441\u044f \u0444\u0430\u0439\u043b room.ejs!<\/p>\n<figure class=\"\"><figcaption><\/figcaption><\/figure>\n<h3>\u0414\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 CSS<\/h3>\n<p>\u0412\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u043d\u0435 \u043e\u0447\u0435\u043d\u044c \u0445\u043e\u0440\u043e\u0448\u043e, \u043f\u0440\u0430\u0432\u0434\u0430? \u042d\u0442\u043e \u043f\u043e\u0442\u043e\u043c\u0443, \u0447\u0442\u043e \u0432 \u0432\u0430\u0448\u0435\u043c \u043f\u0440\u043e\u0435\u043a\u0442\u0435 \u043d\u0435\u0442 \u0441\u0442\u0438\u043b\u0435\u0439. \u0418\u0442\u0430\u043a, \u0434\u043e\u0431\u0430\u0432\u044c\u0442\u0435 \u043d\u0435\u043c\u043d\u043e\u0433\u043e CSS.<\/p>\n<p>\u041d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043d\u043e\u0432\u0443\u044e \u043f\u0430\u043f\u043a\u0443 \u0432 \u043f\u0440\u043e\u0435\u043a\u0442 \u043f\u043e\u0434 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435\u043c public. \u0412 \u044d\u0442\u043e\u0439 \u043f\u0430\u043f\u043a\u0435 \u0441\u043e\u0437\u0434\u0430\u0439\u0442\u0435 \u0444\u0430\u0439\u043b\u044b style.css \u0438 script.js. \u0412\u043e\u0442 \u0432\u0430\u0448\u0430 \u043d\u043e\u0432\u0430\u044f \u0444\u0430\u0439\u043b\u043e\u0432\u0430\u044f \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430:<\/p>\n<pre><code>|-- weather-app    |-- views       |-- index.ejs    |-- public       |-- style.css       |-- script.js    |-- package.json    |-- server.js<\/code><\/pre>\n<p>Express \u043d\u0435 \u0434\u0430\u0451\u0442 \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a \u044d\u0442\u043e\u043c\u0443 \u0444\u0430\u0439\u043b\u0443 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0432\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u043e\u0442\u043a\u0440\u044b\u0442\u044c \u0435\u0433\u043e \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u0441\u0442\u0440\u043e\u043a\u0438 \u043a\u043e\u0434\u0430:<\/p>\n<pre><code class=\"javascript\">app.use(express.static(\u2018public\u2019));<\/code><\/pre>\n<p>\u042d\u0442\u043e\u0442 \u043a\u043e\u0434 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0432\u0430\u043c \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0434\u043e\u0441\u0442\u0443\u043f \u043a\u043e \u0432\u0441\u0435\u043c \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u043c \u0444\u0430\u0439\u043b\u0430\u043c \u0432 \u043f\u0430\u043f\u043a\u0435 \u201cpublic\u201d. \u041d\u0430\u043a\u043e\u043d\u0435\u0446, \u0432\u0430\u043c \u043d\u0443\u0436\u0435\u043d CSS. \u041f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u044d\u0442\u043e \u043d\u0435 \u043a\u0443\u0440\u0441 \u043f\u043e CSS, \u044f \u043d\u0435 \u0431\u0443\u0434\u0443 \u0432\u0434\u0430\u0432\u0430\u0442\u044c\u0441\u044f \u0432 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e\u0441\u0442\u0438, \u043d\u043e \u0435\u0441\u043b\u0438 \u0432\u044b \u0445\u043e\u0442\u0438\u0442\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043c\u043e\u0438 \u0441\u0442\u0438\u043b\u0438, \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0441\u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0438\u0445 <a href=\"https:\/\/github.com\/itstaranarora\/video-chat-v1\/blob\/master\/public\/style.css\"><u>\u043e\u0442\u0441\u044e\u0434\u0430<\/u><\/a>.<\/p>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0442\u043e\u0433\u043e \u043a\u0430\u043a \u0432\u044b \u0434\u043e\u0431\u0430\u0432\u0438\u043b\u0438 CSS, \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u043e\u0441\u0435\u0442\u0438\u0442\u044c: localhost:3030. \u0412\u044b \u0437\u0430\u043c\u0435\u0442\u0438\u0442\u0435, \u0447\u0442\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043b\u0443\u0447\u0448\u0435.<\/p>\n<h3>\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u043a\u043e\u043c\u043d\u0430\u0442<\/h3>\n<p>\u041a \u043d\u0430\u0441\u0442\u043e\u044f\u0449\u0435\u043c\u0443 \u043c\u043e\u043c\u0435\u043d\u0442\u0443 \u0432\u0430\u0448 \u0444\u0430\u0439\u043b server.js \u0434\u043e\u043b\u0436\u0435\u043d \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u0442\u0430\u043a:<\/p>\n<p><iframe id=\"606c4b2f388fa3867a8ff3f3\" src=\"https:\/\/embedd.srv.habr.com\/iframe\/606c4b2f388fa3867a8ff3f3\" class=\"embed_video embed__content\" allowfullscreen=\"true\"><\/iframe><\/p>\n<p>\u0423 \u0432\u0430\u0441 \u0435\u0441\u0442\u044c \u043e\u0434\u0438\u043d GET-\u0440\u043e\u0443\u0442 \u0438 \u0437\u0430\u043f\u0443\u0441\u043a \u0441\u0435\u0440\u0432\u0435\u0440\u0430. \u041e\u0434\u043d\u0430\u043a\u043e, \u0447\u0442\u043e\u0431\u044b \u0432\u0430\u0448\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u043b\u043e, \u043d\u0443\u0436\u043d\u043e \u0432\u0441\u044f\u043a\u0438\u0439 \u0440\u0430\u0437, \u043a\u043e\u0433\u0434\u0430 \u043d\u043e\u0432\u044b\u0439 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u043f\u043e\u0441\u0435\u0449\u0430\u0435\u0442 \u0432\u0430\u0448 \u0440\u043e\u0443\u0442 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e, \u043f\u0435\u0440\u0435\u043d\u0430\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u0435\u0433\u043e \u043d\u0430 \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u0439 URL-\u0430\u0434\u0440\u0435\u0441. \u0421\u043b\u0435\u0434\u0443\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 uuid \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e\u0433\u043e \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u043e\u0433\u043e URL-\u0430\u0434\u0440\u0435\u0441\u0430 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0439 \u043a\u043e\u043c\u043d\u0430\u0442\u044b.<\/p>\n<p>UUID \u2014 \u044d\u0442\u043e \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 javascript, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0432\u0430\u043c \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u0435 \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u044b. \u0412 \u0432\u0430\u0448\u0435\u043c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438 \u0432\u044b \u0431\u0443\u0434\u0435\u0442\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c uuid \u0432\u0435\u0440\u0441\u0438\u0438 4 \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u043e\u0433\u043e URL. \u041d\u043e \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u0438\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u0443\u0439\u0442\u0435 uuid \u0432 server.js.&nbsp;<\/p>\n<pre><code class=\"javascript\">const { v4: uuidv4 } = require(\"uuid\");<\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0443\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <a href=\"https:\/\/www.npmjs.com\/package\/uuid\"><u>uuid<\/u><\/a> \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e\u0433\u043e \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u0430 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0439 \u043a\u043e\u043c\u043d\u0430\u0442\u044b \u0438 \u043f\u0435\u0440\u0435\u043d\u0430\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0432 \u044d\u0442\u0443 \u043a\u043e\u043c\u043d\u0430\u0442\u0443.<\/p>\n<pre><code class=\"javascript\">app.get(\u201c\/\u201d, (req, res) =&gt; {     res.redirect(`\/${uuidv4()}`); });<\/code><\/pre>\n<p>\u0418, \u043f\u0440\u0435\u0436\u0434\u0435 \u0447\u0435\u043c \u0432\u044b \u043f\u0440\u043e\u0442\u0435\u0441\u0442\u0438\u0440\u0443\u0435\u0442\u0435 \u044d\u0442\u043e, \u044f \u0442\u0430\u043a\u0436\u0435 \u0445\u043e\u0442\u0435\u043b \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0443 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0439 \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u043e\u0439 \u043a\u043e\u043c\u043d\u0430\u0442\u044b, \u0438 \u0432\u044b \u043f\u0435\u0440\u0435\u0434\u0430\u0434\u0438\u0442\u0435 \u0442\u0435\u043a\u0443\u0449\u0438\u0439 URL \u044d\u0442\u043e\u0439 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0435.<\/p>\n<pre><code class=\"javascript\">app.get(\u201c\/:room\u201d, (req, res) =&gt; {     res.render(\u201croom\u201d, { roomId: req.param.room }); });<\/code><\/pre>\n<p>\u0412\u044b \u043f\u0435\u0440\u0435\u0434\u0430\u043b\u0438 roomId \u0432 room.ejs \u043d\u0430 \u044d\u0442\u043e\u043c \u0437\u0430\u043a\u043e\u043d\u0447\u0438\u043b\u0438 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0443 \u0432\u0430\u0448\u0438\u0445 \u043a\u043e\u043c\u043d\u0430\u0442. \u0410 \u0442\u0435\u043f\u0435\u0440\u044c, \u0435\u0441\u043b\u0438 \u0432\u044b \u043f\u043e\u0441\u0435\u0442\u0438\u0442\u0435 localhost:3030, \u0432\u044b \u0431\u0443\u0434\u0435\u0442\u0435 \u043f\u0435\u0440\u0435\u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u044b \u043d\u0430 \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u0439 URL.<\/p>\n<figure class=\"\"><figcaption><\/figcaption><\/figure>\n<h3>\u0414\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0432\u0438\u0434\u0435\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f<\/h3>\n<p>\u0412\u044b \u0431\u0443\u0434\u0435\u0442\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 \u0444\u0430\u0439\u043b\u043e\u043c script.js, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432\u044b \u0441\u043e\u0437\u0434\u0430\u043b\u0438 \u0440\u0430\u043d\u0435\u0435. script.js \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u044c \u0432\u0435\u0441\u044c \u043a\u043b\u0438\u0435\u043d\u0442\u0441\u043a\u0438\u0439 \u043a\u043e\u0434 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f.<\/p>\n<p>\u0418\u0442\u0430\u043a, \u0432\u043e\u0442 \u0447\u0442\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c: \u043d\u0443\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0432\u0438\u0434\u0435\u043e\u043f\u043e\u0442\u043e\u043a, \u0430 \u0437\u0430\u0442\u0435\u043c \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u044d\u0442\u043e\u0442 \u043f\u043e\u0442\u043e\u043a \u0432 \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u0432\u0438\u0434\u0435\u043e.<\/p>\n<pre><code class=\"javascript\">let myVideoStream; const videoGrid = document.getElementById(\"video-grid\"); const myVideo = document.createElement(\"video\"); myVideo.muted = true; navigator.mediaDevices.getUserMedia({     audio: true,     video: true, }) .then((stream) =&gt; {     myVideoStream = stream;     addVideoStream(myVideo, stream); });<\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0441\u043e\u0437\u0434\u0430\u0439\u0442\u0435\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u044e addVideoStream, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0434\u043e\u0431\u0430\u0432\u0438\u0442 \u043f\u043e\u0442\u043e\u043a \u043a \u0432\u0438\u0434\u0435\u043e\u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0443.<\/p>\n<pre><code class=\"javascript\">const addVideoStream = (video, stream) =&gt; {     video.srcObject = stream;     video.addEventListener(\"loadedmetadata\", () =&gt; {        video.play();        videoGrid.append(video);     }); };<\/code><\/pre>\n<p>\u042d\u0442\u043e\u0442 \u043a\u043e\u0434 \u0434\u043e\u0431\u0430\u0432\u0438\u0442 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0439 \u043f\u043e\u0442\u043e\u043a \u043a \u0432\u0438\u0434\u0435\u043e\u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0443. \u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u044d\u0442\u043e, \u043f\u043e\u0441\u0435\u0442\u0438\u0432 localhost:3030, \u0438 \u0432\u044b \u0443\u0432\u0438\u0434\u0438\u0442\u0435 \u0432\u0441\u043f\u043b\u044b\u0432\u0430\u044e\u0449\u0435\u0435 \u043e\u043a\u043d\u043e \u0441 \u0432\u0438\u0434\u0435\u043e&nbsp;<\/p>\n<figure class=\"\"><figcaption><\/figcaption><\/figure>\n<h3>\u0414\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u0440\u0430\u0437\u0440\u0435\u0448\u0438\u0442\u044c \u0434\u0440\u0443\u0433\u0438\u043c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f\u043c \u0442\u0440\u0430\u043d\u0441\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u0432\u043e\u0438 \u0432\u0438\u0434\u0435\u043e \u0432 \u043f\u043e\u0442\u043e\u043a\u043e\u0432\u043e\u043c \u0440\u0435\u0436\u0438\u043c\u0435.<\/h3>\n<p>\u041f\u0440\u0438\u0448\u043b\u043e \u0432\u0440\u0435\u043c\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c Socket.io \u0438 PeerJS. \u0414\u043b\u044f \u0442\u0435\u0445, \u043a\u0442\u043e \u043d\u0435 \u0437\u043d\u0430\u0435\u0442, Socket.io \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u0441\u0435\u0440\u0432\u0435\u0440\u0443 \u0438 \u043a\u043b\u0438\u0435\u043d\u0442\u0443 \u0432 \u0440\u0435\u0436\u0438\u043c\u0435 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438.&nbsp; PeerJS \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0442 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c WebRTC.<\/p>\n<p>\u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u0438\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u0443\u0439\u0442\u0435 socket.io \u0438 peerjs \u0432 server.js \u0438 \u043f\u0440\u043e\u0441\u043b\u0443\u0448\u0430\u0439\u0442\u0435 \u0441\u043e\u0431\u044b\u0442\u0438\u0435 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f.<\/p>\n<pre><code class=\"javascript\">\/\/ server.js const express = require(\u201cexpress\u201d); const app = express(); const server = require(\u201chttp\u201d).Server(app); const { v4: uuidv4 } = require(\u201cuuid\u201d); app.set(\u201cview engine\u201d, \u201cejs\u201d); const io = require(\u201csocket.io\u201d)(server); const { ExpressPeerServer } = require(\u201cpeer\u201d); const peerServer = ExpressPeerServer(server, {     debug: true, }); app.use(\u201c\/peerjs\u201d, peerServer); app.use(express.static(\u201cpublic\u201d)); app.get(\u201c\/\u201d, (req, res) =&gt; {     res.redirect(`\/${uuidv4()}`); }); app.get(\u201c\/:room\u201d, (req, res) =&gt; {     res.render(\u201croom\u201d, { roomId: req.param.room }); }); io.on(\u201cconnection\u201d, (socket) =&gt; {     socket.on(\u201cjoin-room\u201d, (roomId, userId) =&gt; {     socket.join(roomId);     socket.to(roomId).broadcast.emit(\u201cuser-connected\u201d, userId);     }); }); server.listen(3030);<\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0432\u0430\u0448 \u0441\u0435\u0440\u0432\u0435\u0440 \u043f\u0440\u043e\u0441\u043b\u0443\u0448\u0438\u0432\u0430\u0435\u0442 \u0441\u043e\u0431\u044b\u0442\u0438\u0435 \u043f\u0440\u0438\u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f \u043a \u043a\u043e\u043c\u043d\u0430\u0442\u0435. \u0414\u0430\u043b\u0435\u0435 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u0442\u0435 \u0432\u0430\u0448 script.js.<\/p>\n<pre><code class=\"javascript\">\/\/ public\/script.js const socket = io(\u201c\/\u201d); const videoGrid = document.getElementById(\u201cvideo-grid\u201d); const myVideo = document.createElement(\u201cvideo\u201d); myVideo.muted = true; var peer = new Peer(undefined, {   path: \u201c\/peerjs\u201d,   host: \u201c\/\u201d,   port: \u201c3030\u201d, }); let myVideoStream; navigator.mediaDevices   .getUserMedia({   audio: true,   video: true, }) .then((stream) =&gt; {   myVideoStream = stream;   addVideoStream(myVideo, stream);   peer.on(\u201ccall\u201d, (call) =&gt; {     call.answer(stream);     const video = document.createElement(\u201cvideo\u201d);     call.on(\u201cstream\u201d, (userVideoStream) =&gt; {       addVideoStream(video, userVideoStream);       });     });   socket.on(\u201cuser-connected\u201d, (userId) =&gt; {       connectToNewUser(userId, stream);   }); }); const connectToNewUser = (userId, stream) =&gt; {   const call = peer.call(userId, stream);   const video = document.createElement(\u201cvideo\u201d);   call.on(\u201cstream\u201d, (userVideoStream) =&gt; {       addVideoStream(video, userVideoStream);   }); }; peer.on(\u201copen\u201d, (id) =&gt; {     socket.emit(\u201cjoin-room\u201d, ROOM_ID, id); }); const addVideoStream = (video, stream) =&gt; {   video.srcObject = stream;   video.addEventListener(\u201cloadedmetadata\u201d, () =&gt; {     video.play();     videoGrid.append(video);   }); };<\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c, \u0435\u0441\u043b\u0438 \u0432 \u043a\u043e\u043c\u043d\u0430\u0442\u0443 \u0432\u043e\u0439\u0434\u0451\u0442 \u043d\u043e\u0432\u044b\u0439 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c, \u0432\u044b \u0443\u0432\u0438\u0434\u0438\u0442\u0435 \u0435\u0433\u043e \u0432\u0438\u0434\u0435\u043e.<\/p>\n<h3>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u043e\u0433\u043e \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430<\/h3>\n<p>\u0421 \u0432\u0438\u0434\u0435\u043e\u0447\u0430\u0441\u0442\u044c\u044e \u0437\u0430\u043a\u043e\u043d\u0447\u0438\u043b\u0438. \u0410 \u0442\u0435\u043f\u0435\u0440\u044c \u0437\u0430\u0439\u043c\u0438\u0442\u0435\u0441\u044c \u0441\u0442\u0438\u043b\u0438\u0437\u0430\u0446\u0438\u0435\u0439. \u041d\u043e \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u0434\u043e\u0431\u0430\u0432\u044c\u0442\u0435 \u043a\u043e\u043d\u0442\u0435\u043d\u0442 \u0432 \u0444\u0430\u0439\u043b room.ejs. (\u0414\u043e\u0431\u0430\u0432\u044c\u0442\u0435 CDN font-awesome \u0432\u043d\u0443\u0442\u0440\u0438 \u0442\u0435\u0433\u0430 head.)<\/p>\n<pre><code>\/\/ views\/room.ejs &lt;body&gt;   &lt;div class=\"header\"&gt;     &lt;div class=\"logo\"&gt;       &lt;h3&gt;Video Chat&lt;\/h2&gt;     &lt;\/div&gt;   &lt;\/div&gt;   &lt;div class=\"main\"&gt;     &lt;div class=\"main__left\"&gt;       &lt;div class=\"videos__group\"&gt;         &lt;div id=\"video-grid\"&gt;&lt;\/div&gt;       &lt;\/div&gt;       &lt;div class=\"options\"&gt;         &lt;div class=\"options__left\"&gt;           &lt;div class=\"options__button\"&gt;             &lt;i class=\"fa fa-video-camera\" aria-hidden=\"true\"&gt;&lt;\/i&gt;           &lt;\/div&gt;         &lt;div class=\"options__button\"&gt;             &lt;i class=\"fa fa-microphone\" aria-hidden=\"true\"&gt;&lt;\/i&gt;         &lt;\/div&gt;        &lt;\/div&gt;        &lt;div class=\"options__right\"&gt;          &lt;div class=\"options__button background__red\"&gt;            &lt;i class=\"fa fa-phone\" aria-hidden=\"true\"&gt;&lt;\/i&gt;          &lt;\/div&gt;        &lt;\/div&gt;      &lt;\/div&gt;     &lt;\/div&gt;     &lt;div class=\"main__right\"&gt;       &lt;div class=\"main__chat_window\"&gt;         &lt;ul class=\"messages\"&gt;&lt;\/ul&gt;      &lt;\/div&gt;      &lt;div class=\"main__message_container\"&gt;        &lt;input id=\"chat_message\" type=\"text\" placeholder=\"Type <\/code><\/pre>\n<\/hr>\n<\/div>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-320961","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/320961","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=320961"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/320961\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=320961"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=320961"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=320961"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}