{"id":456504,"date":"2025-04-18T15:00:34","date_gmt":"2025-04-18T15:00:34","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=456504"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=456504","title":{"rendered":"<span>\u041d\u0430 \u043f\u0430\u043b\u044c\u0446\u0430\u0445 \u043f\u0440\u043e WebRTC \u043d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0441\u0432\u043e\u0435\u0433\u043e \u043c\u0435\u0441\u0441\u0435\u043d\u0434\u0436\u0435\u0440\u0430<\/span>"},"content":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u0421\u0435\u0433\u043e\u0434\u043d\u044f \u0440\u0430\u0437\u0431\u0435\u0440\u0451\u043c\u0441\u044f, \u043a\u0430\u043a \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0432\u0438\u0434\u0435\u043e\u0437\u0432\u043e\u043d\u043a\u0438 \u2014 \u0442\u0443 \u0441\u0430\u043c\u0443\u044e \u0444\u0438\u0447\u0443, \u0431\u0435\u0437 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0441\u043b\u043e\u0436\u043d\u043e \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0441\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0435 \u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u0432 2025 \u0433\u043e\u0434\u0443, \u043d\u0430 <a href=\"https:\/\/github.com\/xarvel\/messenger-example\" rel=\"noopener noreferrer nofollow\">\u043f\u0440\u0438\u043c\u0435\u0440\u0435<\/a> \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043c\u0435\u0441\u0441\u0435\u043d\u0434\u0436\u0435\u0440\u0430.<\/p>\n<p>\u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043c\u044b \u043f\u043e\u0437\u043d\u0430\u043a\u043e\u043c\u0438\u043c\u0441\u044f \u0441 WebRTC \u2014 \u0442\u0435\u0445\u043d\u043e\u043b\u043e\u0433\u0438\u0435\u0439, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f\u043c  \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0442\u044c \u043f\u0440\u044f\u043c\u043e\u0435 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 \u0434\u0440\u0443\u0433 \u0441 \u0434\u0440\u0443\u0433\u043e\u043c \u0434\u043b\u044f \u043e\u0431\u043c\u0435\u043d\u0430 \u0430\u0443\u0434\u0438\u043e, \u0432\u0438\u0434\u0435\u043e \u0438 \u0434\u0440\u0443\u0433\u0438\u043c\u0438 \u0434\u0430\u043d\u043d\u044b\u043c\u0438. \u042d\u0442\u043e \u043c\u043e\u0449\u043d\u044b\u0439, \u043d\u043e \u043c\u0435\u0441\u0442\u0430\u043c\u0438 \u043a\u0430\u043f\u0440\u0438\u0437\u043d\u044b\u0439 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0442\u0440\u0435\u0431\u0443\u0435\u0442 \u043f\u043e\u043d\u0438\u043c\u0430\u043d\u0438\u044f \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u044b, \u0441\u0438\u0433\u043d\u0430\u043b\u0438\u043d\u0433\u0430 \u0438 \u0441\u0435\u0442\u0435\u0432\u044b\u0445 \u043d\u044e\u0430\u043d\u0441\u043e\u0432 \u0432\u0440\u043e\u0434\u0435 NAT \u0438 ICE.<\/p>\n<p>\u0412 \u044d\u0442\u043e\u0439 \u0447\u0430\u0441\u0442\u0438 \u043c\u044b:<\/p>\n<ul>\n<li>\n<p>\u0440\u0430\u0437\u0431\u0435\u0440\u0451\u043c\u0441\u044f, \u043a\u0430\u043a \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 WebRTC \u043f\u043e\u0434 \u043a\u0430\u043f\u043e\u0442\u043e\u043c;<\/p>\n<\/li>\n<li>\n<p>\u043d\u0430\u043f\u0438\u0448\u0435\u043c \u0441\u0438\u0433\u043d\u0430\u043b\u044c\u043d\u044b\u0439 \u0441\u0435\u0440\u0432\u0435\u0440 \u0434\u043b\u044f \u043e\u0431\u043c\u0435\u043d\u0430 \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u043c\u0435\u0436\u0434\u0443 \u0443\u0447\u0430\u0441\u0442\u043d\u0438\u043a\u0430\u043c\u0438 \u0437\u0432\u043e\u043d\u043a\u0430;<\/p>\n<\/li>\n<li>\n<p>\u043d\u0430\u0443\u0447\u0438\u043c \u043a\u043b\u0438\u0435\u043d\u0442\u043e\u0432 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0442\u044c\u0441\u044f \u0434\u0440\u0443\u0433 \u043a \u0434\u0440\u0443\u0433\u0443 \u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0442\u044c \u043c\u0435\u0434\u0438\u0430\u043f\u043e\u0442\u043e\u043a\u0438;<\/p>\n<\/li>\n<li>\n<p>\u043d\u0430\u0441\u0442\u0440\u043e\u0438\u043c \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0443 STUN \u0438 TURN \u2014 \u0447\u0442\u043e\u0431\u044b \u0437\u0432\u043e\u043d\u043a\u0438 \u0440\u0430\u0431\u043e\u0442\u0430\u043b\u0438 \u0434\u0430\u0436\u0435 \u0437\u0430 NAT \u0438\u043b\u0438 \u0432 \u043c\u043e\u0431\u0438\u043b\u044c\u043d\u044b\u0445 \u0441\u0435\u0442\u044f\u0445;<\/p>\n<\/li>\n<\/ul>\n<p>\u0413\u043e\u0442\u043e\u0432\u044b? \u041f\u043e\u0435\u0445\u0430\u043b\u0438 \ud83d\ude80<\/p>\n<h3>\u0410\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0430 \u0432\u0438\u0434\u0435\u043e-\u0437\u0432\u043e\u043d\u043a\u043e\u0432: \u043a\u0430\u043a \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 WebRTC<\/h3>\n<p>\u041f\u0440\u0435\u0436\u0434\u0435 \u0447\u0435\u043c \u043f\u0438\u0441\u0430\u0442\u044c \u043a\u043e\u0434, \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u0440\u0430\u0437\u0431\u0435\u0440\u0451\u043c\u0441\u044f, \u0447\u0442\u043e \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 &#171;\u043f\u043e\u0434 \u043a\u0430\u043f\u043e\u0442\u043e\u043c&#187;, \u043a\u043e\u0433\u0434\u0430 \u0432\u044b \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442\u0435 \u0432\u0438\u0434\u0435\u043e\u0437\u0432\u043e\u043d\u043e\u043a.<\/p>\n<p><strong>WebRTC (Web Real-Time Communication)<\/strong> \u2014 \u044d\u0442\u043e \u0442\u0435\u0445\u043d\u043e\u043b\u043e\u0433\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0434\u0432\u0443\u043c \u043a\u043b\u0438\u0435\u043d\u0442\u0430\u043c (\u0447\u0430\u0449\u0435 \u0432\u0441\u0435\u0433\u043e \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0430\u043c \u0438\u043b\u0438 \u043c\u043e\u0431\u0438\u043b\u044c\u043d\u044b\u043c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f\u043c) \u043e\u0431\u043c\u0435\u043d\u0438\u0432\u0430\u0442\u044c\u0441\u044f \u0430\u0443\u0434\u0438\u043e, \u0432\u0438\u0434\u0435\u043e, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u044b\u043c\u0438 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f\u043c\u0438. \u0422\u0430\u043a\u043e\u0435 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f <strong>P2P (peer-to-peer)<\/strong> \u2014 \u0432 \u0438\u0434\u0435\u0430\u043b\u0435 \u043c\u0435\u0434\u0438\u0430-\u0442\u0440\u0430\u0444\u0438\u043a \u043f\u0435\u0440\u0435\u0434\u0430\u0451\u0442\u0441\u044f \u043d\u0430\u043f\u0440\u044f\u043c\u0443\u044e \u043c\u0435\u0436\u0434\u0443 \u043a\u043b\u0438\u0435\u043d\u0442\u0430\u043c\u0438, \u0447\u0442\u043e \u0441\u043d\u0438\u0436\u0430\u0435\u0442 \u0437\u0430\u0434\u0435\u0440\u0436\u043a\u0443 \u0438 \u043d\u0430\u0433\u0440\u0443\u0437\u043a\u0443 \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440. \u0410 \u0435\u0441\u043b\u0438 \u043f\u0440\u044f\u043c\u043e\u0435 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 \u043d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u0432 \u0434\u0435\u043b\u043e \u0432\u0441\u0442\u0443\u043f\u0430\u0435\u0442 TURN-\u0441\u0435\u0440\u0432\u0435\u0440, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0440\u0435\u0442\u0440\u0430\u043d\u0441\u043b\u0438\u0440\u0443\u0435\u0442 \u0442\u0440\u0430\u0444\u0438\u043a \u043c\u0435\u0436\u0434\u0443 \u0443\u0447\u0430\u0441\u0442\u043d\u0438\u043a\u0430\u043c\u0438.<\/p>\n<p>\u0412 \u043e\u0442\u043b\u0438\u0447\u0438\u0435 \u043e\u0442 WebSocket, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043f\u043e\u0432\u0435\u0440\u0445 TCP \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0434\u043b\u044f \u0447\u0430\u0442\u043e\u0432, <strong>WebRTC \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u0432 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u043c UDP<\/strong>. \u042d\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0434\u043e\u0431\u0438\u0442\u044c\u0441\u044f \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0439 \u0437\u0430\u0434\u0435\u0440\u0436\u043a\u0438 \u043f\u0440\u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0435 \u0430\u0443\u0434\u0438\u043e \u0438 \u0432\u0438\u0434\u0435\u043e, \u0447\u0442\u043e \u043a\u0440\u0438\u0442\u0438\u0447\u043d\u043e \u0434\u043b\u044f \u0437\u0432\u043e\u043d\u043a\u043e\u0432 \u0438 \u0441\u0442\u0440\u0438\u043c\u0438\u043d\u0433\u0430.<\/p>\n<blockquote>\n<p>WebRTC \u2014 \u044d\u0442\u043e \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u0440\u043e \u0432\u0438\u0434\u0435\u043e \u0438 \u0430\u0443\u0434\u0438\u043e. \u041e\u043d \u0442\u0430\u043a\u0436\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0443 \u043b\u044e\u0431\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u043c\u0435\u0436\u0434\u0443 \u043a\u043b\u0438\u0435\u043d\u0442\u0430\u043c\u0438 \u0447\u0435\u0440\u0435\u0437 RTCDataChannel. \u0421 \u0435\u0433\u043e \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043c\u043e\u0436\u043d\u043e, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u044b\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u043d\u0430\u043f\u0440\u044f\u043c\u0443\u044e, \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0444\u0430\u0439\u043b\u043e\u043e\u0431\u043c\u0435\u043d \u0438\u043b\u0438 \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u0438\u0437\u0430\u0446\u0438\u044e \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0439 \u043c\u0435\u0436\u0434\u0443 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f\u043c\u0438 \u0431\u0435\u0437 \u0443\u0447\u0430\u0441\u0442\u0438\u044f \u0441\u0435\u0440\u0432\u0435\u0440\u0430.<\/p>\n<\/blockquote>\n<p>\u0412\u043e\u0442 \u0438\u0437 \u0447\u0435\u0433\u043e \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0442\u0438\u043f\u0438\u0447\u043d\u044b\u0439 WebRTC-\u0437\u0432\u043e\u043d\u043e\u043a:<\/p>\n<h4>1. \u041e\u0431\u043c\u0435\u043d \u0442\u0435\u0445\u043d\u0438\u0447\u0435\u0441\u043a\u0438\u043c\u0438 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430\u043c\u0438 (SDP)<\/h4>\n<p>\u041a\u043e\u0433\u0434\u0430 \u043e\u0434\u0438\u043d \u043a\u043b\u0438\u0435\u043d\u0442 \u0445\u043e\u0447\u0435\u0442 \u043f\u043e\u0437\u0432\u043e\u043d\u0438\u0442\u044c \u0434\u0440\u0443\u0433\u043e\u043c\u0443, \u043e\u043d \u0444\u043e\u0440\u043c\u0438\u0440\u0443\u0435\u0442 \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u0435 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f \u2014 <strong>SDP (Session Description Protocol)<\/strong>. \u042d\u0442\u043e \u043e\u0431\u044b\u0447\u043d\u044b\u0439 \u0442\u0435\u043a\u0441\u0442, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043e\u043f\u0438\u0441\u0430\u043d\u043e:<\/p>\n<ul>\n<li>\n<p>\u043a\u0430\u043a\u0438\u0435 \u043c\u0435\u0434\u0438\u0430 (\u0430\u0443\u0434\u0438\u043e\/\u0432\u0438\u0434\u0435\u043e) \u0431\u0443\u0434\u0443\u0442 \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0442\u044c\u0441\u044f,<\/p>\n<\/li>\n<li>\n<p>\u043a\u0430\u043a\u0438\u0435 \u043a\u043e\u0434\u0435\u043a\u0438 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u044e\u0442\u0441\u044f,<\/p>\n<\/li>\n<li>\n<p>\u043a\u0430\u043a\u0438\u0435 \u043f\u043e\u0440\u0442\u044b \u0441\u043b\u0443\u0448\u0430\u0442\u044c \u0438 \u0442.\u0434.<\/p>\n<\/li>\n<\/ul>\n<p>\u042d\u0442\u043e\u0442 SDP \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f <strong>offer<\/strong>. \u0412\u0442\u043e\u0440\u043e\u0439 \u043a\u043b\u0438\u0435\u043d\u0442 \u043e\u0442\u0432\u0435\u0447\u0430\u0435\u0442 \u0441\u0432\u043e\u0438\u043c SDP (<strong>answer<\/strong>), \u0433\u0434\u0435 \u0433\u043e\u0432\u043e\u0440\u0438\u0442: \u00ab\u041e\u043a\u0435\u0439, \u044f \u0442\u043e\u0436\u0435 \u0443\u043c\u0435\u044e \u0432\u043e\u0442 \u044d\u0442\u043e\u00bb. \u041d\u043e WebRTC \u043d\u0435 \u0443\u043c\u0435\u0435\u0442 \u0441\u0430\u043c \u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0442\u044c SDP \u043e\u0442 \u043e\u0434\u043d\u043e\u0433\u043e \u043a\u043b\u0438\u0435\u043d\u0442\u0430 \u043a \u0434\u0440\u0443\u0433\u043e\u043c\u0443 \u2014 \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043d\u0443\u0436\u0435\u043d <strong>\u0441\u0438\u0433\u043d\u0430\u043b\u044c\u043d\u044b\u0439 \u0441\u0435\u0440\u0432\u0435\u0440<\/strong>.<\/p>\n<h4>2. \u041f\u043e\u0438\u0441\u043a \u043f\u0443\u0442\u0438 (ICE, STUN \u0438 TURN)<\/h4>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c, \u043a\u043e\u0433\u0434\u0430 \u0441\u0442\u043e\u0440\u043e\u043d\u044b \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0438\u043b\u0438\u0441\u044c \u00ab\u0447\u0442\u043e\u00bb \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0442\u044c, \u0438\u043c \u043d\u0443\u0436\u043d\u043e \u0440\u0435\u0448\u0438\u0442\u044c <strong>\u00ab\u043a\u0430\u043a\u00bb \u0441\u043e\u0435\u0434\u0438\u043d\u0438\u0442\u044c\u0441\u044f<\/strong>. \u0412\u0435\u0434\u044c \u0437\u0430 NAT&#8217;\u0430\u043c\u0438 \u0443 \u043a\u043b\u0438\u0435\u043d\u0442\u043e\u0432 \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u0441\u043a\u0440\u044b\u0442\u044b\u0435 IP \u0438 \u043f\u043e\u0440\u0442\u044b.<\/p>\n<p>\u0422\u0443\u0442 \u0432\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u043f\u0440\u043e\u0446\u0435\u0441\u0441 <strong>ICE (Interactive Connectivity Establishment)<\/strong>:<\/p>\n<ul>\n<li>\n<p>\u043a\u0430\u0436\u0434\u044b\u0439 \u043a\u043b\u0438\u0435\u043d\u0442 \u0441\u043e\u0431\u0438\u0440\u0430\u0435\u0442 \u0441\u043f\u0438\u0441\u043e\u043a \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u0445 \u0430\u0434\u0440\u0435\u0441\u043e\u0432 (\u043d\u0430\u0437\u044b\u0432\u0430\u044e\u0442\u0441\u044f <strong>ICE-\u043a\u0430\u043d\u0434\u0438\u0434\u0430\u0442\u044b<\/strong>),<\/p>\n<\/li>\n<li>\n<p>\u043e\u0431\u043c\u0435\u043d\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0438\u043c\u0438 \u0447\u0435\u0440\u0435\u0437 \u0441\u0438\u0433\u043d\u0430\u043b\u044c\u043d\u044b\u0439 \u0441\u0435\u0440\u0432\u0435\u0440,<\/p>\n<\/li>\n<li>\n<p>WebRTC \u043f\u0440\u043e\u0431\u0443\u0435\u0442 \u0440\u0430\u0437\u043d\u044b\u0435 \u043f\u0443\u0442\u0438, \u043f\u043e\u043a\u0430 \u043d\u0435 \u043d\u0430\u0439\u0434\u0451\u0442 \u0440\u0430\u0431\u043e\u0447\u0438\u0439.<\/p>\n<\/li>\n<\/ul>\n<p>\u0427\u0442\u043e\u0431\u044b \u043d\u0430\u0439\u0442\u0438 \u0441\u0432\u043e\u0439 \u0432\u043d\u0435\u0448\u043d\u0438\u0439 IP \u0438 \u043f\u043e\u0440\u0442, \u043a\u043b\u0438\u0435\u043d\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 <strong>STUN-\u0441\u0435\u0440\u0432\u0435\u0440<\/strong>. \u0415\u0441\u043b\u0438 \u043d\u0430\u043f\u0440\u044f\u043c\u0443\u044e \u0441\u043e\u0435\u0434\u0438\u043d\u0438\u0442\u044c\u0441\u044f \u043d\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u2014 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f <strong>TURN-\u0441\u0435\u0440\u0432\u0435\u0440<\/strong>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0440\u0435\u0442\u0440\u0430\u043d\u0441\u043b\u0438\u0440\u0443\u0435\u0442 \u0432\u0435\u0441\u044c \u0442\u0440\u0430\u0444\u0438\u043a.<\/p>\n<p>\u041f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u043f\u0440\u043e STUN \u0438 TURN \u043c\u044b \u043f\u043e\u0433\u043e\u0432\u043e\u0440\u0438\u043c \u0447\u0443\u0442\u044c \u043d\u0438\u0436\u0435.<\/p>\n<h4>3. \u041f\u0440\u044f\u043c\u043e\u0435 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 \u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0430 \u043c\u0435\u0434\u0438\u0430<\/h4>\n<p>\u041a\u043e\u0433\u0434\u0430 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043e, \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442\u0441\u044f \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0430 \u0430\u0443\u0434\u0438\u043e \u0438 \u0432\u0438\u0434\u0435\u043e \u2014 \u043d\u0430\u043f\u0440\u044f\u043c\u0443\u044e \u043c\u0435\u0436\u0434\u0443 \u043a\u043b\u0438\u0435\u043d\u0442\u0430\u043c\u0438 \u0438\u043b\u0438 \u0447\u0435\u0440\u0435\u0437 TURN. \u0411\u0440\u0430\u0443\u0437\u0435\u0440\u044b (\u0438\u043b\u0438, \u0432 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435, React Native) \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u044e\u0442 \u0432\u0441\u0451 \u044d\u0442\u043e \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438: \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u043b\u0438\u0448\u044c \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u0441\u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c <code>RTCPeerConnection<\/code> \u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u044c \u043d\u0443\u0436\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0447\u0435\u0440\u0435\u0437 \u0441\u0438\u0433\u043d\u0430\u043b\u0438\u043d\u0433.<\/p>\n<h4>\u0427\u0442\u043e \u0442\u0430\u043a\u043e\u0435 SDP \u0438 ICE \u2014 \u043f\u0440\u043e\u0441\u0442\u044b\u043c\u0438 \u0441\u043b\u043e\u0432\u0430\u043c\u0438<\/h4>\n<p>\u041a\u043e\u0433\u0434\u0430 \u0434\u0432\u0430 \u043a\u043b\u0438\u0435\u043d\u0442\u0430 \u0445\u043e\u0442\u044f\u0442 \u043d\u0430\u0447\u0430\u0442\u044c \u0437\u0432\u043e\u043d\u043e\u043a, \u0438\u043c \u043d\u0443\u0436\u043d\u043e \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0438\u0442\u044c\u0441\u044f <em>\u043a\u0430\u043a<\/em> \u044d\u0442\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c: \u043a\u0430\u043a\u0438\u0435 \u043a\u043e\u0434\u0435\u043a\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c, \u043a\u0430\u043a\u0438\u0435 \u043f\u043e\u0440\u0442\u044b \u0441\u043b\u0443\u0448\u0430\u0442\u044c, \u043a\u0430\u043a \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0442\u044c \u0432\u0438\u0434\u0435\u043e \u0438 \u0442.\u0434. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f <strong>SDP (Session Description Protocol)<\/strong> \u2014 \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u044b\u0439 \u0444\u043e\u0440\u043c\u0430\u0442 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f.<\/p>\n<p><strong>SDP<\/strong> \u043f\u0435\u0440\u0435\u0434\u0430\u0451\u0442\u0441\u044f \u043c\u0435\u0436\u0434\u0443 \u043a\u043b\u0438\u0435\u043d\u0442\u0430\u043c\u0438 \u0447\u0435\u0440\u0435\u0437 \u0441\u0438\u0433\u043d\u0430\u043b\u044c\u043d\u044b\u0439 \u0441\u0435\u0440\u0432\u0435\u0440. \u041e\u0434\u0438\u043d \u043a\u043b\u0438\u0435\u043d\u0442 \u0441\u043e\u0437\u0434\u0430\u0451\u0442 <strong>&#171;offer&#187;,<\/strong> \u0432\u0442\u043e\u0440\u043e\u0439 \u043e\u0442\u0432\u0435\u0447\u0430\u0435\u0442 <strong>&#171;answer&#187;<\/strong>. \u0412\u043d\u0443\u0442\u0440\u0438 \u2014 \u0432\u0441\u0451: \u043e\u0442 \u0442\u0438\u043f\u0430 \u043c\u0435\u0434\u0438\u0430\u043f\u043e\u0442\u043e\u043a\u0430 \u0434\u043e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u043e \u0441\u0435\u0442\u0438.<\/p>\n<p>\u041f\u0440\u0438\u043c\u0435\u0440 <code>SDP offer<\/code> \u043c\u043e\u0436\u0435\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u0442\u0430\u043a (\u0441\u0438\u043b\u044c\u043d\u043e \u0443\u043f\u0440\u043e\u0449\u0451\u043d\u043d\u043e):<\/p>\n<pre><code class=\"typescript\">v=0 o=- 123456 2 IN IP4 192.0.2.1 s=- t=0 0 m=audio 49170 RTP\/AVP 0 c=IN IP4 192.0.2.1 a=rtpmap:0 PCMU\/8000<\/code><\/pre>\n<p><strong>ICE (Interactive Connectivity Establishment)<\/strong> \u2014 \u044d\u0442\u043e \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u043f\u043e\u0438\u0441\u043a\u0430 \u043f\u0443\u0442\u0438 \u0434\u043b\u044f \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f \u043c\u0435\u0436\u0434\u0443 \u043a\u043b\u0438\u0435\u043d\u0442\u0430\u043c\u0438. \u0422\u0430\u043a \u043a\u0430\u043a \u043e\u0431\u0430 \u043c\u043e\u0433\u0443\u0442 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u044c\u0441\u044f \u0437\u0430 NAT, \u0438\u043c \u043d\u0443\u0436\u043d\u043e &#171;\u0432\u044b\u0447\u0438\u0441\u043b\u0438\u0442\u044c&#187;, \u043a\u0430\u043a \u0434\u043e\u0441\u0442\u0443\u0447\u0430\u0442\u044c\u0441\u044f \u0434\u0440\u0443\u0433 \u0434\u043e \u0434\u0440\u0443\u0433\u0430: \u043d\u0430\u043f\u0440\u044f\u043c\u0443\u044e, \u0447\u0435\u0440\u0435\u0437 \u043f\u0440\u043e\u043c\u0435\u0436\u0443\u0442\u043e\u0447\u043d\u044b\u0435 \u0430\u0434\u0440\u0435\u0441\u0430 \u0438\u043b\u0438 \u0447\u0435\u0440\u0435\u0437 TURN-\u0441\u0435\u0440\u0432\u0435\u0440.<\/p>\n<p>\u041f\u0440\u0438\u043c\u0435\u0440 ICE-\u043a\u0430\u043d\u0434\u0438\u0434\u0430\u0442\u0430:<\/p>\n<pre><code class=\"json\">{   \"candidate\": \"candidate:842163049 1 udp 1677729535 192.0.2.3 54874 typ srflx raddr 10.0.0.2 rport 54874\",   \"sdpMid\": \"0\",   \"sdpMLineIndex\": 0 }<\/code><\/pre>\n<ul>\n<li>\n<p><code>candidate<\/code>: \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u0430 (IP, \u043f\u043e\u0440\u0442, \u0442\u0438\u043f \u2014 <code>host<\/code>, <code>srflx<\/code>, <code>relay<\/code>);<\/p>\n<\/li>\n<li>\n<p><code>sdpMid<\/code>: ID \u043c\u0435\u0434\u0438\u0430\u043b\u0438\u043d\u0438\u0438 (\u0430\u0443\u0434\u0438\u043e\/\u0432\u0438\u0434\u0435\u043e);<\/p>\n<\/li>\n<li>\n<p><code>sdpMLineIndex<\/code>: \u0438\u043d\u0434\u0435\u043a\u0441 \u043c\u0435\u0434\u0438\u0430\u043b\u0438\u043d\u0438\u0438 (0 \u2014 \u043e\u0431\u044b\u0447\u043d\u043e \u0430\u0443\u0434\u0438\u043e, 1 \u2014 \u0432\u0438\u0434\u0435\u043e \u0438 \u0442.\u043f.).<\/p>\n<\/li>\n<\/ul>\n<p>\u041a\u0430\u0436\u0434\u044b\u0439 \u043a\u043b\u0438\u0435\u043d\u0442 \u0441\u043e\u0431\u0438\u0440\u0430\u0435\u0442 \u0441\u043f\u0438\u0441\u043e\u043a \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u0445 \u0430\u0434\u0440\u0435\u0441\u043e\u0432 (ICE-\u043a\u0430\u043d\u0434\u0438\u0434\u0430\u0442\u043e\u0432) \u0438 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442 \u0438\u0445 \u0434\u0440\u0443\u0433\u043e\u043c\u0443. \u0417\u0430\u0442\u0435\u043c WebRTC \u043f\u0440\u043e\u0431\u0443\u0435\u0442 \u0441\u043e\u0435\u0434\u0438\u043d\u0438\u0442\u044c\u0441\u044f \u043f\u043e \u043d\u0438\u043c \u0432 \u043f\u043e\u0440\u044f\u0434\u043a\u0435 \u043f\u0440\u0438\u043e\u0440\u0438\u0442\u0435\u0442\u0430 \u2014 \u0438 \u0432\u044b\u0431\u0438\u0440\u0430\u0435\u0442 \u043b\u0443\u0447\u0448\u0438\u0439.<\/p>\n<h4>\u041a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u044b<\/h4>\n<p>\u0427\u0442\u043e\u0431\u044b \u0432\u0441\u0451 \u0437\u0430\u0440\u0430\u0431\u043e\u0442\u0430\u043b\u043e, \u043d\u0430\u043c \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u044f\u0442\u0441\u044f:<\/p>\n<ol>\n<li>\n<p>\u0421\u0438\u0433\u043d\u0430\u043b\u044c\u043d\u044b\u0439 \u0441\u0435\u0440\u0432\u0435\u0440 \u2014 \u0434\u043b\u044f \u043f\u0435\u0440\u0432\u043e\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u043e\u0431\u043c\u0435\u043d\u0430 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0435\u0439 \u043c\u0435\u0436\u0434\u0443 \u043a\u043b\u0438\u0435\u043d\u0442\u0430\u043c\u0438. WebRTC \u043d\u0435 \u0432\u043a\u043b\u044e\u0447\u0430\u0435\u0442 \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c \u0441\u0438\u0433\u043d\u0430\u043b\u0438\u043d\u0433\u0430, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043c\u044b \u0441\u0430\u043c\u0438 \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u0443\u0435\u043c \u043e\u0431\u043c\u0435\u043d: <\/p>\n<ul>\n<li>\n<p>\u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435\u043c \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f (SDP),<\/p>\n<\/li>\n<li>\n<p>\u0438 \u0441\u0435\u0442\u0435\u0432\u044b\u043c\u0438 \u0430\u0434\u0440\u0435\u0441\u0430\u043c\u0438 (ICE-\u043a\u0430\u043d\u0434\u0438\u0434\u0430\u0442\u0430\u043c\u0438).<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p>\u041e\u0431\u044b\u0447\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442 WebSocket \u0438\u043b\u0438 \u043b\u044e\u0431\u0443\u044e \u0434\u0440\u0443\u0433\u0443\u044e \u0434\u0432\u0443\u0441\u0442\u043e\u0440\u043e\u043d\u043d\u044e\u044e \u0441\u0432\u044f\u0437\u044c.<\/p>\n<\/li>\n<li>\n<p>STUN-\u0441\u0435\u0440\u0432\u0435\u0440 \u2014 \u043f\u043e\u043c\u043e\u0433\u0430\u0435\u0442 \u043a\u043b\u0438\u0435\u043d\u0442\u0430\u043c \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u0441\u0432\u043e\u0438 \u0432\u043d\u0435\u0448\u043d\u0438\u0435 IP-\u0430\u0434\u0440\u0435\u0441\u0430 \u0438 \u043f\u043e\u0440\u0442\u044b \u0437\u0430 NAT. \u042d\u0442\u043e \u0431\u0435\u0441\u043f\u043b\u0430\u0442\u043d\u043e \u0438 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0432 \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u0435 \u0441\u043b\u0443\u0447\u0430\u0435\u0432.<\/p>\n<\/li>\n<li>\n<p>TURN-\u0441\u0435\u0440\u0432\u0435\u0440 \u2014 \u0435\u0441\u043b\u0438 \u043f\u0440\u044f\u043c\u043e\u0435 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 \u043d\u0435 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f (\u0436\u0451\u0441\u0442\u043a\u0438\u0439 NAT, \u043a\u043e\u0440\u043f\u043e\u0440\u0430\u0442\u0438\u0432\u043d\u044b\u0435 \u0441\u0435\u0442\u0438), \u0442\u0440\u0430\u0444\u0438\u043a \u0438\u0434\u0451\u0442 \u0447\u0435\u0440\u0435\u0437 \u043f\u0440\u043e\u043c\u0435\u0436\u0443\u0442\u043e\u0447\u043d\u044b\u0439 \u0441\u0435\u0440\u0432\u0435\u0440. \u042d\u0442\u043e \u0434\u043e\u0440\u043e\u0436\u0435, \u043d\u043e \u043d\u0430\u0434\u0451\u0436\u043d\u0435\u0435.<\/p>\n<\/li>\n<li>\n<p>\u041a\u043b\u0438\u0435\u043d\u0442\u044b \u2014 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u044e\u0442 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435, \u043f\u043e\u043b\u0443\u0447\u0430\u044e\u0442 \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u043a\u0430\u043c\u0435\u0440\u0435\/\u043c\u0438\u043a\u0440\u043e\u0444\u043e\u043d\u0443, \u043e\u0431\u043c\u0435\u043d\u0438\u0432\u0430\u044e\u0442\u0441\u044f \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u0438 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u044e\u0442 \u0432\u0438\u0434\u0435\u043e.<\/p>\n<\/li>\n<\/ol>\n<h4>\u041f\u043e\u0442\u043e\u043a \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0439<\/h4>\n<ol>\n<li>\n<p>\u041a\u043b\u0438\u0435\u043d\u0442 A \u0438\u043d\u0438\u0446\u0438\u0438\u0440\u0443\u0435\u0442 \u0437\u0432\u043e\u043d\u043e\u043a \u2192 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442 SDP \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440.<\/p>\n<\/li>\n<li>\n<p>\u0421\u0435\u0440\u0432\u0435\u0440 \u043f\u0435\u0440\u0435\u0441\u044b\u043b\u0430\u0435\u0442 SDP \u041a\u043b\u0438\u0435\u043d\u0442\u0443 B.<\/p>\n<\/li>\n<li>\n<p>\u041a\u043b\u0438\u0435\u043d\u0442 B \u043e\u0442\u0432\u0435\u0447\u0430\u0435\u0442 \u0441\u0432\u043e\u0438\u043c SDP.<\/p>\n<\/li>\n<li>\n<p>\u041e\u0431\u0430 \u043a\u043b\u0438\u0435\u043d\u0442\u0430 \u043e\u0431\u043c\u0435\u043d\u0438\u0432\u0430\u044e\u0442\u0441\u044f ICE-\u043a\u0430\u043d\u0434\u0438\u0434\u0430\u0442\u0430\u043c\u0438 \u2014 \u044d\u0442\u043e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f \u043e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u0445 \u043f\u0443\u0442\u044f\u0445 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f.<\/p>\n<\/li>\n<li>\n<p>WebRTC \u0432\u044b\u0431\u0438\u0440\u0430\u0435\u0442 \u043b\u0443\u0447\u0448\u0438\u0439 \u043f\u0443\u0442\u044c (\u043d\u0430\u043f\u0440\u044f\u043c\u0443\u044e, \u0447\u0435\u0440\u0435\u0437 STUN \u0438\u043b\u0438 \u0447\u0435\u0440\u0435\u0437 TURN).<\/p>\n<\/li>\n<li>\n<p>\u041f\u043e\u0442\u043e\u043a \u0432\u0438\u0434\u0435\u043e\/\u0430\u0443\u0434\u0438\u043e \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442 \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0442\u044c\u0441\u044f \u043d\u0430\u043f\u0440\u044f\u043c\u0443\u044e (\u0435\u0441\u043b\u0438 \u043f\u043e\u0432\u0435\u0437\u0451\u0442) \u0438\u043b\u0438 \u0447\u0435\u0440\u0435\u0437 TURN.<\/p>\n<\/li>\n<\/ol>\n<figure class=\"full-width\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/74d\/6ba\/2d7\/74d6ba2d738f25a3e6d993ec069b0126.png\" alt=\"Screenshot 2025-04-10 at 14.38.38.png\" title=\"\u0421\u0445\u0435\u043c\u0430 WebRTC \u0437\u0432\u043e\u043d\u043a\u0430\" width=\"1852\" height=\"1050\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/getpro\/habr\/upload_files\/74d\/6ba\/2d7\/74d6ba2d738f25a3e6d993ec069b0126.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/74d\/6ba\/2d7\/74d6ba2d738f25a3e6d993ec069b0126.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<div><figcaption>\u0421\u0445\u0435\u043c\u0430 WebRTC \u0437\u0432\u043e\u043d\u043a\u0430<\/figcaption><\/div>\n<\/figure>\n<h4>STUN \u0438 TURN: \u043f\u043e\u043c\u043e\u0449\u043d\u0438\u043a\u0438 \u0432 \u043c\u0438\u0440\u0435 NAT&#8217;\u043e\u0432<\/h4>\n<p>\u0412 \u0438\u0434\u0435\u0430\u043b\u044c\u043d\u043e\u043c \u043c\u0438\u0440\u0435 \u0434\u0432\u0430 \u043a\u043b\u0438\u0435\u043d\u0442\u0430 \u0441\u043e\u0435\u0434\u0438\u043d\u044f\u044e\u0442\u0441\u044f \u043d\u0430\u043f\u0440\u044f\u043c\u0443\u044e. \u041d\u043e \u0432 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u043e\u0431\u0430 \u0447\u0430\u0441\u0442\u043e \u043d\u0430\u0445\u043e\u0434\u044f\u0442\u0441\u044f \u0437\u0430 NAT&#8217;\u0430\u043c\u0438 \u2014 \u0440\u043e\u0443\u0442\u0435\u0440\u0430\u043c\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0441\u043a\u0440\u044b\u0432\u0430\u044e\u0442 \u0438\u0445 \u043d\u0430\u0441\u0442\u043e\u044f\u0449\u0438\u0435 IP-\u0430\u0434\u0440\u0435\u0441\u0430. \u0418 \u0442\u0443\u0442 \u043d\u0430 \u043f\u043e\u043c\u043e\u0449\u044c \u043f\u0440\u0438\u0445\u043e\u0434\u044f\u0442 STUN \u0438 TURN.<\/p>\n<p><strong>STUN (Session Traversal Utilities for NAT)<\/strong> \u2014 \u044d\u0442\u043e \u043b\u0451\u0433\u043a\u0438\u0439 \u0441\u0435\u0440\u0432\u0435\u0440, \u043a \u043a\u043e\u0442\u043e\u0440\u043e\u043c\u0443 \u043a\u043b\u0438\u0435\u043d\u0442 \u043e\u0431\u0440\u0430\u0449\u0430\u0435\u0442\u0441\u044f, \u0447\u0442\u043e\u0431\u044b \u0443\u0437\u043d\u0430\u0442\u044c \u0441\u0432\u043e\u0439 <em>\u043f\u0443\u0431\u043b\u0438\u0447\u043d\u044b\u0439 IP \u0438 \u043f\u043e\u0440\u0442<\/em>. \u041f\u043e\u043b\u0443\u0447\u0438\u0432 \u044d\u0442\u0443 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e, \u043a\u043b\u0438\u0435\u043d\u0442 \u043c\u043e\u0436\u0435\u0442 \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u044c \u0435\u0451 \u0434\u0440\u0443\u0433\u043e\u043c\u0443 \u0443\u0447\u0430\u0441\u0442\u043d\u0438\u043a\u0443 \u0437\u0432\u043e\u043d\u043a\u0430 \u043a\u0430\u043a \u043e\u0434\u0438\u043d \u0438\u0437 ICE-\u043a\u0430\u043d\u0434\u0438\u0434\u0430\u0442\u043e\u0432. STUN \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0431\u044b\u0441\u0442\u0440\u043e \u0438 \u0431\u0435\u0441\u043f\u043b\u0430\u0442\u043d\u043e, \u0438 \u044d\u0442\u043e\u0433\u043e \u0447\u0430\u0441\u0442\u043e \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e, \u0435\u0441\u043b\u0438 \u0445\u043e\u0442\u044f \u0431\u044b \u043e\u0434\u0438\u043d \u043a\u043b\u0438\u0435\u043d\u0442 \u043d\u0435 \u0437\u0430 \u0436\u0451\u0441\u0442\u043a\u0438\u043c NAT.<\/p>\n<p><strong>TURN (Traversal Using Relays around NAT)<\/strong> \u2014 \u0440\u0435\u0437\u0435\u0440\u0432\u043d\u044b\u0439 \u043f\u043b\u0430\u043d. \u0415\u0441\u043b\u0438 \u043d\u0430\u043f\u0440\u044f\u043c\u0443\u044e \u0441\u043e\u0435\u0434\u0438\u043d\u0438\u0442\u044c\u0441\u044f \u043d\u0435 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043e\u0431\u0430 \u043a\u043b\u0438\u0435\u043d\u0442\u0430 \u0441\u0438\u0434\u044f\u0442 \u0437\u0430 \u0441\u0438\u043c\u043c\u0435\u0442\u0440\u0438\u0447\u043d\u044b\u043c\u0438 NAT&#8217;\u0430\u043c\u0438 \u0438\u043b\u0438 \u0432 \u043a\u043e\u0440\u043f\u043e\u0440\u0430\u0442\u0438\u0432\u043d\u044b\u0445 \u0441\u0435\u0442\u044f\u0445), TURN-\u0441\u0435\u0440\u0432\u0435\u0440 \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f \u043f\u043e\u0441\u0440\u0435\u0434\u043d\u0438\u043a\u043e\u043c: \u043e\u043d \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u0442\u0440\u0430\u0444\u0438\u043a \u043e\u0442 \u043e\u0434\u043d\u043e\u0433\u043e \u043a\u043b\u0438\u0435\u043d\u0442\u0430 \u0438 \u043f\u0435\u0440\u0435\u0441\u044b\u043b\u0430\u0435\u0442 \u0434\u0440\u0443\u0433\u043e\u043c\u0443. \u042d\u0442\u043e \u043c\u0435\u0434\u043b\u0435\u043d\u043d\u0435\u0435 \u0438 \u0434\u043e\u0440\u043e\u0436\u0435 (\u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u043c\u043e\u0449\u043d\u044b\u0439 \u0441\u0435\u0440\u0432\u0435\u0440 \u0441 \u0445\u043e\u0440\u043e\u0448\u0438\u043c \u043a\u0430\u043d\u0430\u043b\u043e\u043c), \u043d\u043e \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0432\u0430\u0435\u0442 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 \u0432 100% \u0441\u043b\u0443\u0447\u0430\u0435\u0432.<\/p>\n<p>\ud83d\udccc \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0445\u043e\u0440\u043e\u0448\u0430\u044f \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044f WebRTC \u0432\u0441\u0435\u0433\u0434\u0430 \u0432\u043a\u043b\u044e\u0447\u0430\u0435\u0442 <strong>\u043e\u0431\u0430<\/strong> \u0441\u0435\u0440\u0432\u0435\u0440\u0430:<\/p>\n<figure class=\"full-width\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/612\/f2d\/727\/612f2d727822d75434d1a4824401c0de.png\" alt=\"Screenshot 2025-04-10 at 14.39.40.png\" title=\"\u0421\u0432\u044f\u0437\u044c \u0447\u0435\u0440\u0435\u0437 TURN \u0441\u0435\u0440\u0432\u0435\u0440\" width=\"1536\" height=\"836\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/getpro\/habr\/upload_files\/612\/f2d\/727\/612f2d727822d75434d1a4824401c0de.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/612\/f2d\/727\/612f2d727822d75434d1a4824401c0de.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<div><figcaption>\u0421\u0432\u044f\u0437\u044c \u0447\u0435\u0440\u0435\u0437 TURN \u0441\u0435\u0440\u0432\u0435\u0440<\/figcaption><\/div>\n<\/figure>\n<h3>\u041f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u043c \u043a \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438<\/h3>\n<p>\u041c\u044b \u0443\u0436\u0435 \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u043b\u0438\u0441\u044c, \u043a\u0430\u043a \u0443\u0441\u0442\u0440\u043e\u0435\u043d WebRTC: \u0447\u0442\u043e \u0442\u0430\u043a\u043e\u0435 SDP, ICE, STUN \u0438 TURN, \u0437\u0430\u0447\u0435\u043c \u043d\u0443\u0436\u0435\u043d \u0441\u0438\u0433\u043d\u0430\u043b\u044c\u043d\u044b\u0439 \u0441\u0435\u0440\u0432\u0435\u0440 \u0438 \u043a\u0430\u043a \u0441\u0442\u0440\u043e\u0438\u0442\u0441\u044f \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435. \u0422\u0435\u043f\u0435\u0440\u044c \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u0435\u0440\u0435\u0439\u0434\u0451\u043c \u043a \u0441\u0430\u043c\u043e\u043c\u0443 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e\u043c\u0443 \u2014 <strong>\u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0432\u0438\u0434\u0435\u043e\u0437\u0432\u043e\u043d\u043a\u043e\u0432 \u0432 \u043d\u0430\u0448\u0435\u043c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438 \u043d\u0430 React Native<\/strong>. \u041c\u044b \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 <a href=\"https:\/\/github.com\/react-native-webrtc\/react-native-webrtc\" rel=\"noopener noreferrer nofollow\"><code>react-native-webrtc<\/code><\/a> \u2014 \u044d\u0442\u043e \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u0430\u044f \u043e\u0431\u0451\u0440\u0442\u043a\u0430 \u043d\u0430\u0434 WebRTC API \u0434\u043b\u044f React Native. \u041e\u043d\u0430 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u043c\u0435\u0434\u0438\u0430\u043f\u043e\u0442\u043e\u043a\u0430\u043c\u0438, \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f, \u0441\u043b\u0443\u0448\u0430\u0442\u044c \u0441\u043e\u0431\u044b\u0442\u0438\u044f ICE-\u043a\u0430\u043d\u0434\u0438\u0434\u0430\u0442\u043e\u0432 \u0438 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0442\u044c \u0432\u0438\u0434\u0435\u043e \u043f\u0440\u044f\u043c\u043e \u0432 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438.<\/p>\n<p>\u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0441\u0438\u0433\u043d\u0430\u043b\u044c\u043d\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u043c\u044b \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c graphql \u0431\u0435\u043a\u0435\u043d\u0434 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u0432 \u043f\u0440\u043e\u0448\u043b\u043e\u0439 \u0447\u0430\u0441\u0442\u0438. \u0414\u043e\u0431\u0430\u0432\u0438\u043c \u0432 \u043d\u0435\u0433\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u043f\u0435\u0440\u0435\u0441\u044b\u043b\u043a\u0438 \u0441\u0438\u0433\u043d\u0430\u043b\u043e\u0432 \u043c\u0435\u0436\u0434\u0443 \u043a\u043b\u0438\u0435\u043d\u0442\u0430\u043c\u0438:<\/p>\n<pre><code class=\"json\">type CallSignal { \u00a0type: CallSignalType!  # \u0422\u0438\u043f \u0441\u0438\u0433\u043d\u0430\u043b\u0430: OFFER, ANSWER, ICE_CANDIDATE \u0438 \u0442.\u043f. \u00a0payload: String!       # \u0421\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u0441\u0438\u0433\u043d\u0430\u043b\u0430 \u2014 \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, SDP \u0438\u043b\u0438 ICE-\u043a\u0430\u043d\u0434\u0438\u0434\u0430\u0442 (\u0432 \u0432\u0438\u0434\u0435 \u0441\u0442\u0440\u043e\u043a\u0438) \u00a0chatID: String!        # ID \u0447\u0430\u0442\u0430 (\u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u043a\u0430\u043a \"\u043a\u043e\u043c\u043d\u0430\u0442\u0430\" \u0434\u043b\u044f \u0437\u0432\u043e\u043d\u043a\u0430) }        input CallSignalInput { \u00a0type: CallSignalType!  # \u0422\u0438\u043f \u0441\u0438\u0433\u043d\u0430\u043b\u0430 \u00a0payload: String!       # \u0421\u0430\u043c \u0441\u0438\u0433\u043d\u0430\u043b (JSON-\u0441\u0442\u0440\u043e\u043a\u0430) \u00a0chatID: String!        # \u041a \u043a\u0430\u043a\u043e\u043c\u0443 \u0447\u0430\u0442\u0443\/\u0440\u0430\u0437\u0433\u043e\u0432\u043e\u0440\u0443 \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0441\u044f }  type Mutation { \u00a0sendCallSignal(input: CallSignalInput!): Boolean! \u00a0endCall(chatID: String!): Boolean! }  type Subscription { \u00a0callSignalReceived(chatID: String!): CallSignal! \u00a0callEnded(chatID: String!): Boolean! }<\/code><\/pre>\n<p>\u0412\u0441\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u044b \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 <strong>WebRTC<\/strong> \u0432 <strong>react-native<\/strong> \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u0441\u044f \u0432 \u043f\u0430\u043a\u0435\u0442\u0435 <strong>react-native-webrtc<\/strong>.<\/p>\n<p>\u0414\u043b\u044f \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 WebRTC \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f \u043d\u0443\u0436\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043e\u0431\u044a\u0435\u043a\u0442 \u0442\u0438\u043f\u0430 RTCPeerConnection \u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u044c \u0435\u043c\u0443 \u043d\u0430\u0448\u0438 STUN \u0438 TURN \u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432.<\/p>\n<pre><code class=\"typescript\">const pc = new RTCPeerConnection({   iceServers: [     { urls: 'stun:stun.l.google.com:19302' },     {       urls: 'turn:your.turn.server:3478',       username: 'user',       credential: 'password'     }   ] });<\/code><\/pre>\n<p>STUN \u043f\u0440\u043e\u0431\u0443\u0435\u0442 \u043f\u0435\u0440\u0432\u044b\u043c. \u0415\u0441\u043b\u0438 \u043d\u0435 \u0441\u0440\u0430\u0431\u043e\u0442\u0430\u043b\u043e \u2014 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f TURN. \u0412\u0441\u0451 \u044d\u0442\u043e \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u043f\u0440\u043e\u0437\u0440\u0430\u0447\u043d\u043e \u0434\u043b\u044f \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430, \u043d\u043e \u043a\u0440\u0438\u0442\u0438\u0447\u043d\u043e \u0434\u043b\u044f \u0441\u0442\u0430\u0431\u0438\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0432\u0438\u0434\u0435\u043e\u0437\u0432\u043e\u043d\u043a\u043e\u0432.<\/p>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043e\u0431\u044a\u0435\u043a\u0442\u0430 <strong>RTCPeerConnection<\/strong>, \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043d\u0430\u0447\u0438\u043d\u0430\u0442\u044c \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0443 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f \u043c\u0435\u0436\u0434\u0443 \u0434\u0432\u0443\u043c\u044f \u043a\u043b\u0438\u0435\u043d\u0442\u0430\u043c\u0438. \u042d\u0442\u043e\u0442 \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0432\u043a\u043b\u044e\u0447\u0430\u0435\u0442 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0448\u0430\u0433\u043e\u0432:<\/p>\n<h4>\u0413\u0434\u0435 \u0432\u0437\u044f\u0442\u044c STUN \u0438 \u043a\u0430\u043a \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0441\u0432\u043e\u0439 TURN<\/h4>\n<h4>\u0411\u0435\u0441\u043f\u043b\u0430\u0442\u043d\u044b\u0435 STUN-\u0441\u0435\u0440\u0432\u0435\u0440\u044b<\/h4>\n<p>\u0414\u043b\u044f \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0438 \u043f\u0440\u043e\u0442\u043e\u0442\u0438\u043f\u043e\u0432 \u043c\u043e\u0436\u043d\u043e \u0441\u043c\u0435\u043b\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043f\u0443\u0431\u043b\u0438\u0447\u043d\u044b\u0435 STUN-\u0441\u0435\u0440\u0432\u0435\u0440\u044b:<\/p>\n<ul>\n<li>\n<p><code>stun:stun.l.google.com:19302<\/code><\/p>\n<\/li>\n<li>\n<p><code>stun:stun1.l.google.com:19302<\/code><\/p>\n<\/li>\n<li>\n<p><code>stun:stun.stunprotocol.org:3478<\/code><\/p>\n<\/li>\n<\/ul>\n<p>\u041e\u043d\u0438 \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0442 \u0441\u0442\u0430\u0431\u0438\u043b\u044c\u043d\u043e, \u0438 \u043f\u043e\u0447\u0442\u0438 \u0432\u0441\u0435\u0433\u0434\u0430 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0442 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u043f\u0440\u044f\u043c\u043e\u0435 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435.<\/p>\n<h4>TURN-\u0441\u0435\u0440\u0432\u0435\u0440<\/h4>\n<p>\u0415\u0441\u043b\u0438 \u043e\u0431\u0430 \u043a\u043b\u0438\u0435\u043d\u0442\u0430 \u043d\u0430\u0445\u043e\u0434\u044f\u0442\u0441\u044f \u0437\u0430 <strong>\u0436\u0451\u0441\u0442\u043a\u0438\u043c\u0438 NAT&#8217;\u0430\u043c\u0438<\/strong>, \u0438\u043b\u0438 \u0432 \u043a\u043e\u0440\u043f\u043e\u0440\u0430\u0442\u0438\u0432\u043d\u043e\u0439 \u0441\u0435\u0442\u0438, \u0438\u043b\u0438 \u043c\u043e\u0431\u0438\u043b\u044c\u043d\u043e\u0439 \u0441\u0435\u0442\u0438 \u0441 CGNAT \u2014 P2P \u043f\u0440\u043e\u0441\u0442\u043e <strong>\u043d\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u0441\u044f<\/strong>. \u0418 \u0432\u043e\u0442 \u0442\u0443\u0442 \u043d\u0430 \u0441\u0446\u0435\u043d\u0443 \u0432\u044b\u0445\u043e\u0434\u0438\u0442 <strong>TURN-\u0441\u0435\u0440\u0432\u0435\u0440<\/strong>: \u043e\u043d \u0440\u0435\u0442\u0440\u0430\u043d\u0441\u043b\u0438\u0440\u0443\u0435\u0442 \u0432\u0435\u0441\u044c \u0442\u0440\u0430\u0444\u0438\u043a \u043c\u0435\u0436\u0434\u0443 \u043a\u043b\u0438\u0435\u043d\u0442\u0430\u043c\u0438.<\/p>\n<p>\u0427\u0442\u043e\u0431\u044b \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0442\u044c 100% \u0443\u0441\u043f\u0435\u0448\u043d\u044b\u0435 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f, \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e \u0432 \u043f\u0440\u043e\u0434\u0430\u043a\u0448\u0435\u043d\u0435, \u043d\u0443\u0436\u0435\u043d \u0441\u0432\u043e\u0439 TURN-\u0441\u0435\u0440\u0432\u0435\u0440. \u041e\u0434\u0438\u043d \u0438\u0437 \u0441\u0430\u043c\u044b\u0445 \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u044b\u0445 \u0438 \u0431\u0435\u0441\u043f\u043b\u0430\u0442\u043d\u044b\u0445 \u2014 <strong>coturn<\/strong>.<\/p>\n<p>\u0418\u043b\u0438 \u043c\u043e\u0436\u043d\u043e \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043e\u0434\u043d\u0438\u043c \u0438\u0437 \u043e\u0431\u043b\u0430\u0447\u043d\u044b\u0445 TURN-\u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432, \u0446\u0435\u043d\u044b \u0437\u0430\u0432\u0438\u0441\u044f\u0442 \u043e\u0442 \u0442\u0440\u0430\u0444\u0438\u043a\u0430.<\/p>\n<h4>1. \u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u043c\u0435\u0434\u0438\u0430\u043f\u043e\u0442\u043e\u043a\u0438 (\u043a\u0430\u043c\u0435\u0440\u0430 \u0438 \u043c\u0438\u043a\u0440\u043e\u0444\u043e\u043d)<\/h4>\n<p>\u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u043f\u043e\u043b\u0443\u0447\u0438\u043c \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u043a\u0430\u043c\u0435\u0440\u0435 \u0438 \u043c\u0438\u043a\u0440\u043e\u0444\u043e\u043d\u0443 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f:<\/p>\n<pre><code class=\"typescript\">\/\/ \u0418\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u0443\u0435\u043c API \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u043c\u0435\u0434\u0438\u0430-\u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430\u043c\u0438 import {     mediaDevices } from 'react-native-webrtc';  \/\/ \u0417\u0430\u043f\u0440\u0430\u0448\u0438\u0432\u0430\u0435\u043c \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u0430\u0443\u0434\u0438\u043e \u0438 \u0432\u0438\u0434\u0435\u043e (\u0444\u0440\u043e\u043d\u0442\u0430\u043b\u044c\u043d\u0430\u044f \u043a\u0430\u043c\u0435\u0440\u0430, 30 fps) const stream = await mediaDevices.getUserMedia({ audio: true, video: {     frameRate: 30,     facingMode: 'user', }, });  \/\/ \u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0432\u0441\u0435 \u0442\u0440\u0435\u043a\u0438 (\u0430\u0443\u0434\u0438\u043e \u0438 \u0432\u0438\u0434\u0435\u043e) \u0432 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 stream.getTracks().forEach(track =&gt; {     pc.addTrack(track, stream); });<\/code><\/pre>\n<h4>2. \u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 SDP offer (\u0434\u043b\u044f \u0438\u043d\u0438\u0446\u0438\u0430\u0442\u043e\u0440\u0430 \u0437\u0432\u043e\u043d\u043a\u0430)<\/h4>\n<p>\u0415\u0441\u043b\u0438 \u0432\u044b \u0438\u043d\u0438\u0446\u0438\u0438\u0440\u0443\u0435\u0442\u0435 \u0437\u0432\u043e\u043d\u043e\u043a:<\/p>\n<pre><code class=\"typescript\">\/\/ \u0421\u043e\u0437\u0434\u0430\u0451\u043c offer \u2014 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f const offer = await pc.createOffer({ mandatory: { OfferToReceiveAudio: true, OfferToReceiveVideo: true, VoiceActivityDetection: true } });  await pc.setLocalDescription(offer);  \/\/ \u041e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c OFFER SDP \u0447\u0435\u0440\u0435\u0437 \u0441\u0438\u0433\u043d\u0430\u043b\u0438\u043d\u0433 \u0441\u043e\u0431\u0435\u0441\u0435\u0434\u043d\u0438\u043a\u0443 sendCallSignal('OFFER', JSON.stringify(offer));<\/code><\/pre>\n<h4>3. \u041f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 offer \u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 answer (\u0434\u043b\u044f \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u044e\u0449\u0435\u0439 \u0441\u0442\u043e\u0440\u043e\u043d\u044b)<\/h4>\n<p>\u041a\u043e\u0433\u0434\u0430 \u0432\u0442\u043e\u0440\u043e\u0439 \u043a\u043b\u0438\u0435\u043d\u0442 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442 offer \u0447\u0435\u0440\u0435\u0437 \u0441\u0438\u0433\u043d\u0430\u043b\u044c\u043d\u044b\u0439 \u043a\u0430\u043d\u0430\u043b:<\/p>\n<pre><code class=\"typescript\">await pc.setRemoteDescription( new RTCSessionDescription(offer), );  \/\/ \u0421\u043e\u0437\u0434\u0430\u0451\u043c answer \u2014 \u043e\u0442\u0432\u0435\u0442 \u0441 \u043d\u0430\u0448\u0438\u043c\u0438 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430\u043c\u0438 const answer = await pc.createAnswer();  await pc.setLocalDescription(answer);  \/\/ \u041e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c ANSWER SDP \u0441\u043e\u0431\u0435\u0441\u0435\u0434\u043d\u0438\u043a\u0443 sendCallSignal('ANSWER', JSON.stringify(answer)); <\/code><\/pre>\n<h4>4. ICE-\u043a\u0430\u043d\u0434\u0438\u0434\u0430\u0442\u044b (\u0441\u0435\u0442\u0435\u0432\u044b\u0435 \u0430\u0434\u0440\u0435\u0441\u0430)<\/h4>\n<p>WebRTC \u0441\u0430\u043c \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442 \u0441\u043e\u0431\u0438\u0440\u0430\u0442\u044c ICE-\u043a\u0430\u043d\u0434\u0438\u0434\u0430\u0442\u044b. \u041a\u0430\u0436\u0434\u044b\u0439 \u043d\u0443\u0436\u043d\u043e \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u0434\u0440\u0443\u0433\u043e\u0439 \u0441\u0442\u043e\u0440\u043e\u043d\u0435 \u0447\u0435\u0440\u0435\u0437 \u0441\u0438\u0433\u043d\u0430\u043b\u0438\u043d\u0433:<\/p>\n<pre><code class=\"typescript\">\/\/ \u041e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u0441\u043e\u0431\u044b\u0442\u0438\u044f: \u043d\u0430\u0439\u0434\u0435\u043d \u043d\u043e\u0432\u044b\u0439 ICE-\u043a\u0430\u043d\u0434\u0438\u0434\u0430\u0442 pc.addEventListener('icecandidate', event =&gt; {     if (event.candidate) {         \/\/ \u041e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c ICE \u043a\u0430\u043d\u0434\u0438\u0434\u0430\u0442\u0430 \u0441\u043e\u0431\u0435\u0441\u0435\u0434\u043d\u0438\u043a\u0443 \u0447\u0435\u0440\u0435\u0437 \u0441\u0438\u0433\u043d\u0430\u043b\u0438\u043d\u0433         sendCallSignal('ICE_CANDIDATE', JSON.stringify(event.candidate));     } });<\/code><\/pre>\n<p>ICE-\u043a\u0430\u043d\u0434\u0438\u0434\u0430\u0442\u044b \u043f\u0440\u0438\u0445\u043e\u0434\u044f\u0442 \u043d\u0435 \u0432\u0441\u0435 \u0441\u0440\u0430\u0437\u0443 \u2014 \u0430 \u043f\u043e\u0441\u0442\u0435\u043f\u0435\u043d\u043d\u043e, \u0432 \u0442\u0435\u0447\u0435\u043d\u0438\u0435 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u0441\u0435\u043a\u0443\u043d\u0434. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0438\u0445 \u043d\u0443\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u0441\u044b\u043b\u0430\u0442\u044c <strong>\u043a\u0430\u0436\u0434\u044b\u0439 \u0440\u0430\u0437<\/strong>, \u043a\u043e\u0433\u0434\u0430 \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442 \u043d\u043e\u0432\u044b\u0439.<\/p>\n<p>\u0418 \u043f\u0440\u0438 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0438:<\/p>\n<pre><code class=\"typescript\">\/\/ \u041f\u0440\u0438 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0438 ICE-\u043a\u0430\u043d\u0434\u0438\u0434\u0430\u0442\u0430 \u043e\u0442 \u0441\u043e\u0431\u0435\u0441\u0435\u0434\u043d\u0438\u043a\u0430: const iceCandidate = new RTCIceCandidate(candidate); await pc.addIceCandidate(iceCandidate)<\/code><\/pre>\n<p>\ud83d\udca1 <em>\u0421\u043e\u0432\u0435\u0442:<\/em> \u0434\u043e\u0431\u0430\u0432\u044c\u0442\u0435 <code>iceConnectionStateChange<\/code> \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a, \u0447\u0442\u043e\u0431\u044b \u043e\u0442\u0441\u043b\u0435\u0436\u0438\u0432\u0430\u0442\u044c \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f \u0438 \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044e \u0441\u0442\u0430\u0442\u0443\u0441 (\u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \/ \u043e\u0442\u043a\u043b\u044e\u0447\u0435\u043d\u043e \/ \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u043e).<\/p>\n<h4>5. \u041e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u0432\u0438\u0434\u0435\u043e \u0443\u0434\u0430\u043b\u0451\u043d\u043d\u043e\u0433\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f<\/h4>\n<p>\u041a\u043e\u0433\u0434\u0430 \u0434\u0440\u0443\u0433\u043e\u0439 \u043a\u043b\u0438\u0435\u043d\u0442 \u043d\u0430\u0447\u043d\u0451\u0442 \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0442\u044c \u043c\u0435\u0434\u0438\u0430\u043f\u043e\u0442\u043e\u043a:<\/p>\n<pre><code class=\"typescript\">\/\/ \u041e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u0441\u043e\u0431\u044b\u0442\u0438\u044f: \u043f\u043e\u043b\u0443\u0447\u0435\u043d \u0443\u0434\u0430\u043b\u0451\u043d\u043d\u044b\u0439 \u043c\u0435\u0434\u0438\u0430\u043f\u043e\u0442\u043e\u043a pc.addEventListener('track', event =&gt; {     \/\/ \u0421\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u043c \u043f\u043e\u0442\u043e\u043a \u0434\u043b\u044f \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u043d\u0430 \u044d\u043a\u0440\u0430\u043d\u0435     if (event.streams &amp;&amp; event.streams[0]) {         setRemoteStream(event.streams[0]); } });<\/code><\/pre>\n<p>\u041f\u043e\u0441\u043b\u0435 \u044d\u0442\u0438\u0445 \u0448\u0430\u0433\u043e\u0432 \u0434\u0432\u0430 \u043a\u043b\u0438\u0435\u043d\u0442\u0430 \u0431\u0443\u0434\u0443\u0442 \u0432\u0438\u0434\u0435\u0442\u044c \u0438 \u0441\u043b\u044b\u0448\u0430\u0442\u044c \u0434\u0440\u0443\u0433 \u0434\u0440\u0443\u0433\u0430, \u0435\u0441\u043b\u0438 ICE-\u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u2014 \u043d\u0430\u043f\u0440\u044f\u043c\u0443\u044e (P2P) \u0438\u043b\u0438 \u0447\u0435\u0440\u0435\u0437 TURN.<\/p>\n<h3>\u0412\u0445\u043e\u0434\u044f\u0449\u0438\u0435 \u0437\u0432\u043e\u043d\u043a\u0438 \u0438 push-\u0443\u0432\u0435\u0434\u043e\u043c\u043b\u0435\u043d\u0438\u044f<\/h3>\n<p>\u0427\u0442\u043e\u0431\u044b \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u043c\u043e\u0433 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0437\u0432\u043e\u043d\u043e\u043a, \u0434\u0430\u0436\u0435 \u0435\u0441\u043b\u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0437\u0430\u043a\u0440\u044b\u0442\u043e \u2014 \u043d\u0443\u0436\u0435\u043d <strong>push-\u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c<\/strong>.<\/p>\n<p>\u0418\u0434\u0435\u0430\u043b\u044c\u043d\u044b\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u2014 <strong>push \u0443\u0432\u0435\u0434\u043e\u043c\u043b\u0435\u043d\u0438\u0435 \u0441 \u0438\u043d\u0442\u0435\u0440\u0430\u043a\u0442\u0438\u0432\u043d\u044b\u043c UI<\/strong>, \u043a\u0430\u043a \u0443 Telegram \u0438\u043b\u0438 WhatsApp:<\/p>\n<blockquote>\n<p>\u00ab\u0412\u0430\u043c \u0437\u0432\u043e\u043d\u0438\u0442 \u0418\u0432\u0430\u043d \u0418\u0432\u0430\u043d\u043e\u0432. \u041f\u0440\u0438\u043d\u044f\u0442\u044c \/ \u041e\u0442\u043a\u043b\u043e\u043d\u0438\u0442\u044c\u00bb.<\/p>\n<\/blockquote>\n<h3>\u0413\u0440\u0443\u043f\u043f\u043e\u0432\u044b\u0435 \u0437\u0432\u043e\u043d\u043a\u0438: \u0431\u043e\u043b\u044c\u0448\u0435 \u0434\u0432\u0443\u0445 \u0443\u0447\u0430\u0441\u0442\u043d\u0438\u043a\u043e\u0432 (SFU)<\/h3>\n<p>WebRTC \u0438\u0437 \u043a\u043e\u0440\u043e\u0431\u043a\u0438 \u043e\u0442\u043b\u0438\u0447\u043d\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0432 \u043c\u043e\u0434\u0435\u043b\u0438 <strong>&#171;\u043e\u0434\u0438\u043d \u043d\u0430 \u043e\u0434\u0438\u043d&#187;<\/strong> (P2P), \u043d\u043e \u043a\u0430\u043a \u0442\u043e\u043b\u044c\u043a\u043e \u0432\u044b \u0445\u043e\u0442\u0438\u0442\u0435 \u0441\u043e\u0437\u0432\u043e\u043d\u0438\u0442\u044c\u0441\u044f \u0432\u0442\u0440\u043e\u0451\u043c, \u043d\u0430\u0447\u0438\u043d\u0430\u044e\u0442\u0441\u044f \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b. \u041a\u0430\u0436\u0434\u044b\u0439 \u0443\u0447\u0430\u0441\u0442\u043d\u0438\u043a \u0434\u043e\u043b\u0436\u0435\u043d \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u0435 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 \u0441 \u043a\u0430\u0436\u0434\u044b\u043c \u0434\u0440\u0443\u0433\u0438\u043c: \u044d\u0442\u043e <strong>mesh-\u0441\u0445\u0435\u043c\u0430<\/strong>.<\/p>\n<p>\u0422\u0430\u043a\u043e\u0439 \u043f\u043e\u0434\u0445\u043e\u0434 \u0431\u044b\u0441\u0442\u0440\u043e \u0443\u043f\u0438\u0440\u0430\u0435\u0442\u0441\u044f \u0432 \u043f\u043e\u0442\u043e\u043b\u043e\u043a:<\/p>\n<ul>\n<li>\n<p>\u043f\u0440\u0438 4 \u0443\u0447\u0430\u0441\u0442\u043d\u0438\u043a\u0430\u0445 \u043a\u0430\u0436\u0434\u044b\u0439 \u0441\u0442\u0440\u0438\u043c\u0438\u0442 3 \u0432\u0438\u0434\u0435\u043e \u043f\u043e\u0442\u043e\u043a\u0430 = \u00d74 \u043d\u0430\u0433\u0440\u0443\u0437\u043a\u0438;<\/p>\n<\/li>\n<li>\n<p>\u043f\u0440\u0438 6 \u2014 \u0443\u0436\u0435 5 \u043f\u043e\u0442\u043e\u043a\u043e\u0432 \u043d\u0430 \u043a\u0430\u0436\u0434\u043e\u0433\u043e;<\/p>\n<\/li>\n<li>\n<p>\u0438 \u0432\u0441\u0451 \u044d\u0442\u043e \u043f\u043e uplink\u2019\u0443 \u0442\u0435\u043b\u0435\u0444\u043e\u043d\u0430 \ud83d\ude05<\/p>\n<\/li>\n<\/ul>\n<h4>\u0420\u0435\u0448\u0435\u043d\u0438\u0435 \u2014 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c SFU<\/h4>\n<p><strong>SFU (Selective Forwarding Unit)<\/strong> \u2014 \u044d\u0442\u043e \u0441\u0435\u0440\u0432\u0435\u0440, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u043f\u043e\u0442\u043e\u043a\u0438 \u043e\u0442 \u0443\u0447\u0430\u0441\u0442\u043d\u0438\u043a\u043e\u0432 \u0438 \u0440\u0430\u0437\u0434\u0430\u0451\u0442 \u0438\u0445 \u0434\u0440\u0443\u0433\u0438\u043c. \u041a\u043b\u0438\u0435\u043d\u0442\u044b \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u044e\u0442 <strong>\u043e\u0434\u0438\u043d<\/strong> \u0438\u0441\u0445\u043e\u0434\u044f\u0449\u0438\u0439 \u043f\u043e\u0442\u043e\u043a (\u0430 \u043d\u0435 5), \u0430 SFU \u0443\u0436\u0435 \u00ab\u043f\u0435\u0440\u0435\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u0435\u0442\u00bb \u0438\u0445 \u043c\u0435\u0436\u0434\u0443 \u0443\u0447\u0430\u0441\u0442\u043d\u0438\u043a\u0430\u043c\u0438.<\/p>\n<p>\u041f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u044b\u0435 SFU-\u0440\u0435\u0448\u0435\u043d\u0438\u044f:<\/p>\n<ul>\n<li>\n<p><a href=\"https:\/\/mediasoup.org\/\" rel=\"noopener noreferrer nofollow\">mediasoup<\/a> \u2014 \u043c\u043e\u0449\u043d\u044b\u0439 SFU \u043d\u0430 Node.js + C++;<\/p>\n<\/li>\n<li>\n<p>Janus \u2014 \u043b\u0451\u0433\u043a\u0438\u0439 \u0438 \u0433\u0438\u0431\u043a\u0438\u0439;<\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/github.com\/jitsi\/jitsi-videobridge\" rel=\"noopener noreferrer nofollow\">Jitsi Videobridge<\/a> \u2014 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0432 Jitsi Meet;<\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/livekit.io\/\" rel=\"noopener noreferrer nofollow\">LiveKit<\/a> \u2014 \u0441\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0439 open-source \u0441\u0442\u0435\u043a \u0441 mobile SDK.<\/p>\n<\/li>\n<\/ul>\n<p>\u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 SFU \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043c\u0435\u043d\u044f\u0435\u0442 \u043b\u043e\u0433\u0438\u043a\u0443:<\/p>\n<ul>\n<li>\n<p>\u0437\u0432\u043e\u043d\u043e\u043a \u0431\u043e\u043b\u044c\u0448\u0435 \u043d\u0435 P2P, \u0430 \u0447\u0435\u0440\u0435\u0437 \u0441\u0435\u0440\u0432\u0435\u0440;<\/p>\n<\/li>\n<li>\n<p>\u0432\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u043f\u043e\u0434\u043f\u0438\u0441\u043a\u0430\u043c\u0438 \u043d\u0430 \u043f\u043e\u0442\u043e\u043a\u0438 (\u043a\u0442\u043e \u043a\u043e\u0433\u043e \u0432\u0438\u0434\u0438\u0442);<\/p>\n<\/li>\n<li>\n<p>\u0441\u0438\u0433\u043d\u0430\u043b\u0438\u043d\u0433 \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f \u0441\u043b\u043e\u0436\u043d\u0435\u0435 \u2014 \u043d\u0443\u0436\u043d\u043e \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0443\u0447\u0430\u0441\u0442\u043d\u0438\u043a\u043e\u0432, \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 layout&#8217;\u043e\u043c, mute\/unmute \u0438 \u0442.\u0434.<\/p>\n<\/li>\n<\/ul>\n<p>\u041d\u043e \u0432 \u043e\u0431\u043c\u0435\u043d \u0432\u044b \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0435 <strong>\u043c\u0430\u0441\u0448\u0442\u0430\u0431\u0438\u0440\u0443\u0435\u043c\u043e\u0441\u0442\u044c<\/strong> \u0438 <strong>\u043a\u043e\u043d\u0442\u0440\u043e\u043b\u044c<\/strong>, \u0447\u0442\u043e \u0434\u0435\u043b\u0430\u0435\u0442 SFU \u043d\u0435\u0437\u0430\u043c\u0435\u043d\u0438\u043c\u044b\u043c \u0434\u043b\u044f \u0433\u0440\u0443\u043f\u043f\u043e\u0432\u044b\u0445 \u0437\u0432\u043e\u043d\u043a\u043e\u0432.<\/p>\n<figure class=\"full-width\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/461\/aad\/e68\/461aade68ff6aff6c104a485db496c7f.png\" alt=\"Screenshot 2025-04-10 at 14.37.27.png\" title=\"\u0413\u0440\u0443\u043f\u043f\u043e\u0432\u044b\u0435 \u0437\u0432\u043e\u043d\u043a\u0438\" width=\"2398\" height=\"1368\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/getpro\/habr\/upload_files\/461\/aad\/e68\/461aade68ff6aff6c104a485db496c7f.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/461\/aad\/e68\/461aade68ff6aff6c104a485db496c7f.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<div><figcaption>\u0413\u0440\u0443\u043f\u043f\u043e\u0432\u044b\u0435 \u0437\u0432\u043e\u043d\u043a\u0438<\/figcaption><\/div>\n<\/figure>\n<h3>\u0411\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u044c \u0432 WebRTC-\u0437\u0432\u043e\u043d\u043a\u0430\u0445<\/h3>\n<p>\u041a\u043e\u0433\u0434\u0430 \u0440\u0435\u0447\u044c \u0437\u0430\u0445\u043e\u0434\u0438\u0442 \u043e \u0437\u0432\u043e\u043d\u043a\u0430\u0445, \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e \u0432\u0438\u0434\u0435\u043e, <strong>\u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u044c \u2014 \u043d\u0435 \u043e\u043f\u0446\u0438\u044f, \u0430 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u044c<\/strong>. \u041a \u0441\u0447\u0430\u0441\u0442\u044c\u044e, WebRTC \u0443\u0436\u0435 \u0438\u0437 \u043a\u043e\u0440\u043e\u0431\u043a\u0438 \u0434\u0435\u043b\u0430\u0435\u0442 \u043c\u043d\u043e\u0433\u043e\u0435 \u0437\u0430 \u043d\u0430\u0441, \u043d\u043e \u0435\u0441\u0442\u044c \u0438 \u043f\u043e\u0434\u0432\u043e\u0434\u043d\u044b\u0435 \u043a\u0430\u043c\u043d\u0438, \u043e \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0441\u0442\u043e\u0438\u0442 \u0437\u043d\u0430\u0442\u044c.<\/p>\n<h4>\u0428\u0438\u0444\u0440\u043e\u0432\u0430\u043d\u0438\u0435<\/h4>\n<p>WebRTC <strong>\u0432\u0441\u0435\u0433\u0434\u0430<\/strong> \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 <strong>\u0441\u043a\u0432\u043e\u0437\u043d\u043e\u0435 \u0448\u0438\u0444\u0440\u043e\u0432\u0430\u043d\u0438\u0435<\/strong>:<\/p>\n<ul>\n<li>\n<p><strong>SRTP (Secure RTP)<\/strong> \u2014 \u0434\u043b\u044f \u0430\u0443\u0434\u0438\u043e\/\u0432\u0438\u0434\u0435\u043e \u0442\u0440\u0430\u0444\u0438\u043a\u0430;<\/p>\n<\/li>\n<li>\n<p><strong>DTLS (Datagram TLS)<\/strong> \u2014 \u0434\u043b\u044f \u043a\u043b\u044e\u0447\u0435\u0432\u043e\u0433\u043e \u043e\u0431\u043c\u0435\u043d\u0430 \u0438 \u0441\u0438\u0433\u043d\u0430\u043b\u043e\u0432 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f.<\/p>\n<\/li>\n<\/ul>\n<p>\u042d\u0442\u043e \u0437\u043d\u0430\u0447\u0438\u0442, \u0447\u0442\u043e:<\/p>\n<ul>\n<li>\n<p>\u0434\u0430\u0436\u0435 \u0435\u0441\u043b\u0438 \u043a\u0442\u043e-\u0442\u043e \u043f\u0435\u0440\u0435\u0445\u0432\u0430\u0442\u0438\u0442 \u0442\u0440\u0430\u0444\u0438\u043a (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0432 Wi-Fi-\u0441\u0435\u0442\u0438), \u043e\u043d \u043d\u0435 \u0441\u043c\u043e\u0436\u0435\u0442 \u0435\u0433\u043e \u0440\u0430\u0441\u0448\u0438\u0444\u0440\u043e\u0432\u0430\u0442\u044c;<\/p>\n<\/li>\n<li>\n<p>\u0434\u0430\u0436\u0435 TURN-\u0441\u0435\u0440\u0432\u0435\u0440, \u0447\u0435\u0440\u0435\u0437 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u0440\u043e\u0445\u043e\u0434\u0438\u0442 \u0432\u0435\u0441\u044c \u043f\u043e\u0442\u043e\u043a, \u0432\u0438\u0434\u0438\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u0437\u0430\u0448\u0438\u0444\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435.<\/p>\n<\/li>\n<\/ul>\n<p>\u0410 \u043a\u0430\u043a \u043d\u0430\u0441\u0447\u0451\u0442 \u0441\u0438\u0433\u043d\u0430\u043b\u0438\u043d\u0433\u0430? \u0412\u043e\u0442 \u0442\u0443\u0442 \u0443\u0436\u0435 \u0432\u0441\u0451 \u0437\u0430\u0432\u0438\u0441\u0438\u0442 \u043e\u0442 <strong>\u0432\u0430\u0441<\/strong>.<\/p>\n<p>WebRTC \u043d\u0435 \u0434\u0438\u043a\u0442\u0443\u0435\u0442, \u043a\u0430\u043a \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u0438\u0433\u043d\u0430\u043b\u0438\u043d\u0433 \u2014 \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c WebSocket, GraphQL, REST, \u043f\u043e\u0447\u0442\u043e\u0432\u044b\u0445 \u0433\u043e\u043b\u0443\u0431\u0435\u0439\u2026 \u041d\u043e \u0438\u043c\u0435\u043d\u043d\u043e \u0447\u0435\u0440\u0435\u0437 \u044d\u0442\u043e\u0442 \u043a\u0430\u043d\u0430\u043b \u043f\u0435\u0440\u0435\u0434\u0430\u0451\u0442\u0441\u044f <strong>SDP \u0438 ICE-\u043a\u0430\u043d\u0434\u0438\u0434\u0430\u0442\u044b<\/strong> \u2014 \u0442\u043e \u0435\u0441\u0442\u044c \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f \u043e \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0438.<\/p>\n<h2>\u0418\u0442\u043e\u0433\u043e<\/h2>\n<p>\u0412 <a href=\"https:\/\/habr.com\/ru\/articles\/892298\/\" rel=\"noopener noreferrer nofollow\">\u043f\u0435\u0440\u0432\u043e\u0439 \u0447\u0430\u0441\u0442\u0438<\/a> \u043c\u044b \u043d\u0430\u0447\u0430\u043b\u0438 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u0441\u0432\u043e\u0439 \u043c\u0435\u0441\u0441\u0435\u043d\u0434\u0436\u0435\u0440 \u0441 \u043d\u0443\u043b\u044f: \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043b\u0438 \u0441\u0435\u0440\u0432\u0435\u0440 \u043d\u0430 WebSocket, \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u043e\u0432\u0430\u043b\u0438 \u043e\u0431\u043c\u0435\u043d \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f\u043c\u0438 \u043c\u0435\u0436\u0434\u0443 \u043a\u043b\u0438\u0435\u043d\u0442\u0430\u043c\u0438, \u0438 \u0434\u0430\u0436\u0435 \u0434\u043e\u0431\u0430\u0432\u0438\u043b\u0438 \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u0435 \u0438\u0441\u0442\u043e\u0440\u0438\u0438 \u0447\u0430\u0442\u043e\u0432.<\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0430\u0448 \u043c\u0435\u0441\u0441\u0435\u043d\u0434\u0436\u0435\u0440 \u0443\u043c\u0435\u0435\u0442 \u0434\u0435\u043b\u0430\u0442\u044c \u0432\u0438\u0434\u0435\u043e\u0437\u0432\u043e\u043d\u043a\u0438. \u041c\u044b \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u043b\u0438\u0441\u044c, \u043a\u0430\u043a \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 WebRTC, \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u043b\u0438 \u0441\u0438\u0433\u043d\u0430\u043b\u0438\u043d\u0433 \u0447\u0435\u0440\u0435\u0437 GraphQL, \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u043b\u0438 \u043a\u0430\u043c\u0435\u0440\u0443 \u0438 \u043c\u0438\u043a\u0440\u043e\u0444\u043e\u043d, \u043e\u0431\u043c\u0435\u043d\u044f\u043b\u0438\u0441\u044c SDP \u0438 ICE-\u043a\u0430\u043d\u0434\u0438\u0434\u0430\u0442\u0430\u043c\u0438, \u0438 \u043d\u0430\u043a\u043e\u043d\u0435\u0446 \u2014 \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0438 \u0440\u0430\u0431\u043e\u0447\u0435\u0435 P2P-\u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 \u043c\u0435\u0436\u0434\u0443 \u043a\u043b\u0438\u0435\u043d\u0442\u0430\u043c\u0438.<\/p>\n<p>\u0421\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 <a href=\"https:\/\/github.com\/xarvel\/messenger-example\" rel=\"noopener noreferrer nofollow\">\u043f\u0440\u0438\u043c\u0435\u0440<\/a> <\/p>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><br \/> \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\/articles\/902084\/\"> https:\/\/habr.com\/ru\/articles\/902084\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u0421\u0435\u0433\u043e\u0434\u043d\u044f \u0440\u0430\u0437\u0431\u0435\u0440\u0451\u043c\u0441\u044f, \u043a\u0430\u043a \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0432\u0438\u0434\u0435\u043e\u0437\u0432\u043e\u043d\u043a\u0438 \u2014 \u0442\u0443 \u0441\u0430\u043c\u0443\u044e \u0444\u0438\u0447\u0443, \u0431\u0435\u0437 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0441\u043b\u043e\u0436\u043d\u043e \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0441\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0435 \u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u0432 2025 \u0433\u043e\u0434\u0443, \u043d\u0430 <a href=\"https:\/\/github.com\/xarvel\/messenger-example\" rel=\"noopener noreferrer nofollow\">\u043f\u0440\u0438\u043c\u0435\u0440\u0435<\/a> \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043c\u0435\u0441\u0441\u0435\u043d\u0434\u0436\u0435\u0440\u0430.<\/p>\n<p>\u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043c\u044b \u043f\u043e\u0437\u043d\u0430\u043a\u043e\u043c\u0438\u043c\u0441\u044f \u0441 WebRTC \u2014 \u0442\u0435\u0445\u043d\u043e\u043b\u043e\u0433\u0438\u0435\u0439, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f\u043c  \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0442\u044c \u043f\u0440\u044f\u043c\u043e\u0435 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 \u0434\u0440\u0443\u0433 \u0441 \u0434\u0440\u0443\u0433\u043e\u043c \u0434\u043b\u044f \u043e\u0431\u043c\u0435\u043d\u0430 \u0430\u0443\u0434\u0438\u043e, \u0432\u0438\u0434\u0435\u043e \u0438 \u0434\u0440\u0443\u0433\u0438\u043c\u0438 \u0434\u0430\u043d\u043d\u044b\u043c\u0438. \u042d\u0442\u043e \u043c\u043e\u0449\u043d\u044b\u0439, \u043d\u043e \u043c\u0435\u0441\u0442\u0430\u043c\u0438 \u043a\u0430\u043f\u0440\u0438\u0437\u043d\u044b\u0439 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0442\u0440\u0435\u0431\u0443\u0435\u0442 \u043f\u043e\u043d\u0438\u043c\u0430\u043d\u0438\u044f \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u044b, \u0441\u0438\u0433\u043d\u0430\u043b\u0438\u043d\u0433\u0430 \u0438 \u0441\u0435\u0442\u0435\u0432\u044b\u0445 \u043d\u044e\u0430\u043d\u0441\u043e\u0432 \u0432\u0440\u043e\u0434\u0435 NAT \u0438 ICE.<\/p>\n<p>\u0412 \u044d\u0442\u043e\u0439 \u0447\u0430\u0441\u0442\u0438 \u043c\u044b:<\/p>\n<ul>\n<li>\n<p>\u0440\u0430\u0437\u0431\u0435\u0440\u0451\u043c\u0441\u044f, \u043a\u0430\u043a \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 WebRTC \u043f\u043e\u0434 \u043a\u0430\u043f\u043e\u0442\u043e\u043c;<\/p>\n<\/li>\n<li>\n<p>\u043d\u0430\u043f\u0438\u0448\u0435\u043c \u0441\u0438\u0433\u043d\u0430\u043b\u044c\u043d\u044b\u0439 \u0441\u0435\u0440\u0432\u0435\u0440 \u0434\u043b\u044f \u043e\u0431\u043c\u0435\u043d\u0430 \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u043c\u0435\u0436\u0434\u0443 \u0443\u0447\u0430\u0441\u0442\u043d\u0438\u043a\u0430\u043c\u0438 \u0437\u0432\u043e\u043d\u043a\u0430;<\/p>\n<\/li>\n<li>\n<p>\u043d\u0430\u0443\u0447\u0438\u043c \u043a\u043b\u0438\u0435\u043d\u0442\u043e\u0432 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0442\u044c\u0441\u044f \u0434\u0440\u0443\u0433 \u043a \u0434\u0440\u0443\u0433\u0443 \u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0442\u044c \u043c\u0435\u0434\u0438\u0430\u043f\u043e\u0442\u043e\u043a\u0438;<\/p>\n<\/li>\n<li>\n<p>\u043d\u0430\u0441\u0442\u0440\u043e\u0438\u043c \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0443 STUN \u0438 TURN \u2014 \u0447\u0442\u043e\u0431\u044b \u0437\u0432\u043e\u043d\u043a\u0438 \u0440\u0430\u0431\u043e\u0442\u0430\u043b\u0438 \u0434\u0430\u0436\u0435 \u0437\u0430 NAT \u0438\u043b\u0438 \u0432 \u043c\u043e\u0431\u0438\u043b\u044c\u043d\u044b\u0445 \u0441\u0435\u0442\u044f\u0445;<\/p>\n<\/li>\n<\/ul>\n<p>\u0413\u043e\u0442\u043e\u0432\u044b? \u041f\u043e\u0435\u0445\u0430\u043b\u0438 \ud83d\ude80<\/p>\n<h3>\u0410\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0430 \u0432\u0438\u0434\u0435\u043e-\u0437\u0432\u043e\u043d\u043a\u043e\u0432: \u043a\u0430\u043a \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 WebRTC<\/h3>\n<p>\u041f\u0440\u0435\u0436\u0434\u0435 \u0447\u0435\u043c \u043f\u0438\u0441\u0430\u0442\u044c \u043a\u043e\u0434, \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u0440\u0430\u0437\u0431\u0435\u0440\u0451\u043c\u0441\u044f, \u0447\u0442\u043e \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 &#171;\u043f\u043e\u0434 \u043a\u0430\u043f\u043e\u0442\u043e\u043c&#187;, \u043a\u043e\u0433\u0434\u0430 \u0432\u044b \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442\u0435 \u0432\u0438\u0434\u0435\u043e\u0437\u0432\u043e\u043d\u043e\u043a.<\/p>\n<p><strong>WebRTC (Web Real-Time Communication)<\/strong> \u2014 \u044d\u0442\u043e \u0442\u0435\u0445\u043d\u043e\u043b\u043e\u0433\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0434\u0432\u0443\u043c \u043a\u043b\u0438\u0435\u043d\u0442\u0430\u043c (\u0447\u0430\u0449\u0435 \u0432\u0441\u0435\u0433\u043e \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0430\u043c \u0438\u043b\u0438 \u043c\u043e\u0431\u0438\u043b\u044c\u043d\u044b\u043c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f\u043c) \u043e\u0431\u043c\u0435\u043d\u0438\u0432\u0430\u0442\u044c\u0441\u044f \u0430\u0443\u0434\u0438\u043e, \u0432\u0438\u0434\u0435\u043e, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u044b\u043c\u0438 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f\u043c\u0438. \u0422\u0430\u043a\u043e\u0435 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f <strong>P2P (peer-to-peer)<\/strong> \u2014 \u0432 \u0438\u0434\u0435\u0430\u043b\u0435 \u043c\u0435\u0434\u0438\u0430-\u0442\u0440\u0430\u0444\u0438\u043a \u043f\u0435\u0440\u0435\u0434\u0430\u0451\u0442\u0441\u044f \u043d\u0430\u043f\u0440\u044f\u043c\u0443\u044e \u043c\u0435\u0436\u0434\u0443 \u043a\u043b\u0438\u0435\u043d\u0442\u0430\u043c\u0438, \u0447\u0442\u043e \u0441\u043d\u0438\u0436\u0430\u0435\u0442 \u0437\u0430\u0434\u0435\u0440\u0436\u043a\u0443 \u0438 \u043d\u0430\u0433\u0440\u0443\u0437\u043a\u0443 \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440. \u0410 \u0435\u0441\u043b\u0438 \u043f\u0440\u044f\u043c\u043e\u0435 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 \u043d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u0432 \u0434\u0435\u043b\u043e \u0432\u0441\u0442\u0443\u043f\u0430\u0435\u0442 TURN-\u0441\u0435\u0440\u0432\u0435\u0440, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0440\u0435\u0442\u0440\u0430\u043d\u0441\u043b\u0438\u0440\u0443\u0435\u0442 \u0442\u0440\u0430\u0444\u0438\u043a \u043c\u0435\u0436\u0434\u0443 \u0443\u0447\u0430\u0441\u0442\u043d\u0438\u043a\u0430\u043c\u0438.<\/p>\n<p>\u0412 \u043e\u0442\u043b\u0438\u0447\u0438\u0435 \u043e\u0442 WebSocket, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043f\u043e\u0432\u0435\u0440\u0445 TCP \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0434\u043b\u044f \u0447\u0430\u0442\u043e\u0432, <strong>WebRTC \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u0432 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u043c UDP<\/strong>. \u042d\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0434\u043e\u0431\u0438\u0442\u044c\u0441\u044f \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0439 \u0437\u0430\u0434\u0435\u0440\u0436\u043a\u0438 \u043f\u0440\u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0435 \u0430\u0443\u0434\u0438\u043e \u0438 \u0432\u0438\u0434\u0435\u043e, \u0447\u0442\u043e \u043a\u0440\u0438\u0442\u0438\u0447\u043d\u043e \u0434\u043b\u044f \u0437\u0432\u043e\u043d\u043a\u043e\u0432 \u0438 \u0441\u0442\u0440\u0438\u043c\u0438\u043d\u0433\u0430.<\/p>\n<blockquote>\n<p>WebRTC \u2014 \u044d\u0442\u043e \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u0440\u043e \u0432\u0438\u0434\u0435\u043e \u0438 \u0430\u0443\u0434\u0438\u043e. \u041e\u043d \u0442\u0430\u043a\u0436\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0443 \u043b\u044e\u0431\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u043c\u0435\u0436\u0434\u0443 \u043a\u043b\u0438\u0435\u043d\u0442\u0430\u043c\u0438 \u0447\u0435\u0440\u0435\u0437 RTCDataChannel. \u0421 \u0435\u0433\u043e \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043c\u043e\u0436\u043d\u043e, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u044b\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u043d\u0430\u043f\u0440\u044f\u043c\u0443\u044e, \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0444\u0430\u0439\u043b\u043e\u043e\u0431\u043c\u0435\u043d \u0438\u043b\u0438 \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u0438\u0437\u0430\u0446\u0438\u044e \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0439 \u043c\u0435\u0436\u0434\u0443 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f\u043c\u0438 \u0431\u0435\u0437 \u0443\u0447\u0430\u0441\u0442\u0438\u044f \u0441\u0435\u0440\u0432\u0435\u0440\u0430.<\/p>\n<\/blockquote>\n<p>\u0412\u043e\u0442 \u0438\u0437 \u0447\u0435\u0433\u043e \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0442\u0438\u043f\u0438\u0447\u043d\u044b\u0439 WebRTC-\u0437\u0432\u043e\u043d\u043e\u043a:<\/p>\n<h4>1. \u041e\u0431\u043c\u0435\u043d \u0442\u0435\u0445\u043d\u0438\u0447\u0435\u0441\u043a\u0438\u043c\u0438 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430\u043c\u0438 (SDP)<\/h4>\n<p>\u041a\u043e\u0433\u0434\u0430 \u043e\u0434\u0438\u043d \u043a\u043b\u0438\u0435\u043d\u0442 \u0445\u043e\u0447\u0435\u0442 \u043f\u043e\u0437\u0432\u043e\u043d\u0438\u0442\u044c \u0434\u0440\u0443\u0433\u043e\u043c\u0443, \u043e\u043d \u0444\u043e\u0440\u043c\u0438\u0440\u0443\u0435\u0442 \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u0435 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f \u2014 <strong>SDP (Session Description Protocol)<\/strong>. \u042d\u0442\u043e \u043e\u0431\u044b\u0447\u043d\u044b\u0439 \u0442\u0435\u043a\u0441\u0442, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043e\u043f\u0438\u0441\u0430\u043d\u043e:<\/p>\n<ul>\n<li>\n<p>\u043a\u0430\u043a\u0438\u0435 \u043c\u0435\u0434\u0438\u0430 (\u0430\u0443\u0434\u0438\u043e\/\u0432\u0438\u0434\u0435\u043e) \u0431\u0443\u0434\u0443\u0442 \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0442\u044c\u0441\u044f,<\/p>\n<\/li>\n<li>\n<p>\u043a\u0430\u043a\u0438\u0435 \u043a\u043e\u0434\u0435\u043a\u0438 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u044e\u0442\u0441\u044f,<\/p>\n<\/li>\n<li>\n<p>\u043a\u0430\u043a\u0438\u0435 \u043f\u043e\u0440\u0442\u044b \u0441\u043b\u0443\u0448\u0430\u0442\u044c \u0438 \u0442.\u0434.<\/p>\n<\/li>\n<\/ul>\n<p>\u042d\u0442\u043e\u0442 SDP \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f <strong>offer<\/strong>. \u0412\u0442\u043e\u0440\u043e\u0439 \u043a\u043b\u0438\u0435\u043d\u0442 \u043e\u0442\u0432\u0435\u0447\u0430\u0435\u0442 \u0441\u0432\u043e\u0438\u043c SDP (<strong>answer<\/strong>), \u0433\u0434\u0435 \u0433\u043e\u0432\u043e\u0440\u0438\u0442: \u00ab\u041e\u043a\u0435\u0439, \u044f \u0442\u043e\u0436\u0435 \u0443\u043c\u0435\u044e \u0432\u043e\u0442 \u044d\u0442\u043e\u00bb. \u041d\u043e WebRTC \u043d\u0435 \u0443\u043c\u0435\u0435\u0442 \u0441\u0430\u043c \u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0442\u044c SDP \u043e\u0442 \u043e\u0434\u043d\u043e\u0433\u043e \u043a\u043b\u0438\u0435\u043d\u0442\u0430 \u043a \u0434\u0440\u0443\u0433\u043e\u043c\u0443 \u2014 \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043d\u0443\u0436\u0435\u043d <strong>\u0441\u0438\u0433\u043d\u0430\u043b\u044c\u043d\u044b\u0439 \u0441\u0435\u0440\u0432\u0435\u0440<\/strong>.<\/p>\n<h4>2. \u041f\u043e\u0438\u0441\u043a \u043f\u0443\u0442\u0438 (ICE, STUN \u0438 TURN)<\/h4>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c, \u043a\u043e\u0433\u0434\u0430 \u0441\u0442\u043e\u0440\u043e\u043d\u044b \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0438\u043b\u0438\u0441\u044c \u00ab\u0447\u0442\u043e\u00bb \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0442\u044c, \u0438\u043c \u043d\u0443\u0436\u043d\u043e \u0440\u0435\u0448\u0438\u0442\u044c <strong>\u00ab\u043a\u0430\u043a\u00bb \u0441\u043e\u0435\u0434\u0438\u043d\u0438\u0442\u044c\u0441\u044f<\/strong>. \u0412\u0435\u0434\u044c \u0437\u0430 NAT&#8217;\u0430\u043c\u0438 \u0443 \u043a\u043b\u0438\u0435\u043d\u0442\u043e\u0432 \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u0441\u043a\u0440\u044b\u0442\u044b\u0435 IP \u0438 \u043f\u043e\u0440\u0442\u044b.<\/p>\n<p>\u0422\u0443\u0442 \u0432\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u043f\u0440\u043e\u0446\u0435\u0441\u0441 <strong>ICE (Interactive Connectivity Establishment)<\/strong>:<\/p>\n<ul>\n<li>\n<p>\u043a\u0430\u0436\u0434\u044b\u0439 \u043a\u043b\u0438\u0435\u043d\u0442 \u0441\u043e\u0431\u0438\u0440\u0430\u0435\u0442 \u0441\u043f\u0438\u0441\u043e\u043a \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u0445 \u0430\u0434\u0440\u0435\u0441\u043e\u0432 (\u043d\u0430\u0437\u044b\u0432\u0430\u044e\u0442\u0441\u044f <strong>ICE-\u043a\u0430\u043d\u0434\u0438\u0434\u0430\u0442\u044b<\/strong>),<\/p>\n<\/li>\n<li>\n<p>\u043e\u0431\u043c\u0435\u043d\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0438\u043c\u0438 \u0447\u0435\u0440\u0435\u0437 \u0441\u0438\u0433\u043d\u0430\u043b\u044c\u043d\u044b\u0439 \u0441\u0435\u0440\u0432\u0435\u0440,<\/p>\n<\/li>\n<li>\n<p>WebRTC \u043f\u0440\u043e\u0431\u0443\u0435\u0442 \u0440\u0430\u0437\u043d\u044b\u0435 \u043f\u0443\u0442\u0438, \u043f\u043e\u043a\u0430 \u043d\u0435 \u043d\u0430\u0439\u0434\u0451\u0442 \u0440\u0430\u0431\u043e\u0447\u0438\u0439.<\/p>\n<\/li>\n<\/ul>\n<p>\u0427\u0442\u043e\u0431\u044b \u043d\u0430\u0439\u0442\u0438 \u0441\u0432\u043e\u0439 \u0432\u043d\u0435\u0448\u043d\u0438\u0439 IP \u0438 \u043f\u043e\u0440\u0442, \u043a\u043b\u0438\u0435\u043d\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 <strong>STUN-\u0441\u0435\u0440\u0432\u0435\u0440<\/strong>. \u0415\u0441\u043b\u0438 \u043d\u0430\u043f\u0440\u044f\u043c\u0443\u044e \u0441\u043e\u0435\u0434\u0438\u043d\u0438\u0442\u044c\u0441\u044f \u043d\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u2014 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f <strong>TURN-\u0441\u0435\u0440\u0432\u0435\u0440<\/strong>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0440\u0435\u0442\u0440\u0430\u043d\u0441\u043b\u0438\u0440\u0443\u0435\u0442 \u0432\u0435\u0441\u044c \u0442\u0440\u0430\u0444\u0438\u043a.<\/p>\n<p>\u041f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u043f\u0440\u043e STUN \u0438 TURN \u043c\u044b \u043f\u043e\u0433\u043e\u0432\u043e\u0440\u0438\u043c \u0447\u0443\u0442\u044c \u043d\u0438\u0436\u0435.<\/p>\n<h4>3. \u041f\u0440\u044f\u043c\u043e\u0435 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 \u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0430 \u043c\u0435\u0434\u0438\u0430<\/h4>\n<p>\u041a\u043e\u0433\u0434\u0430 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043e, \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442\u0441\u044f \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0430 \u0430\u0443\u0434\u0438\u043e \u0438 \u0432\u0438\u0434\u0435\u043e \u2014 \u043d\u0430\u043f\u0440\u044f\u043c\u0443\u044e \u043c\u0435\u0436\u0434\u0443 \u043a\u043b\u0438\u0435\u043d\u0442\u0430\u043c\u0438 \u0438\u043b\u0438 \u0447\u0435\u0440\u0435\u0437 TURN. \u0411\u0440\u0430\u0443\u0437\u0435\u0440\u044b (\u0438\u043b\u0438, \u0432 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435, React Native) \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u044e\u0442 \u0432\u0441\u0451 \u044d\u0442\u043e \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438: \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u043b\u0438\u0448\u044c \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u0441\u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c <code>RTCPeerConnection<\/code> \u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u044c \u043d\u0443\u0436\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0447\u0435\u0440\u0435\u0437 \u0441\u0438\u0433\u043d\u0430\u043b\u0438\u043d\u0433.<\/p>\n<h4>\u0427\u0442\u043e \u0442\u0430\u043a\u043e\u0435 SDP \u0438 ICE \u2014 \u043f\u0440\u043e\u0441\u0442\u044b\u043c\u0438 \u0441\u043b\u043e\u0432\u0430\u043c\u0438<\/h4>\n<p>\u041a\u043e\u0433\u0434\u0430 \u0434\u0432\u0430 \u043a\u043b\u0438\u0435\u043d\u0442\u0430 \u0445\u043e\u0442\u044f\u0442 \u043d\u0430\u0447\u0430\u0442\u044c \u0437\u0432\u043e\u043d\u043e\u043a, \u0438\u043c \u043d\u0443\u0436\u043d\u043e \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0438\u0442\u044c\u0441\u044f <em>\u043a\u0430\u043a<\/em> \u044d\u0442\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c: \u043a\u0430\u043a\u0438\u0435 \u043a\u043e\u0434\u0435\u043a\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c, \u043a\u0430\u043a\u0438\u0435 \u043f\u043e\u0440\u0442\u044b \u0441\u043b\u0443\u0448\u0430\u0442\u044c, \u043a\u0430\u043a \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0442\u044c \u0432\u0438\u0434\u0435\u043e \u0438 \u0442.\u0434. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f <strong>SDP (Session Description Protocol)<\/strong> \u2014 \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u044b\u0439 \u0444\u043e\u0440\u043c\u0430\u0442 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f.<\/p>\n<p><strong>SDP<\/strong> \u043f\u0435\u0440\u0435\u0434\u0430\u0451\u0442\u0441\u044f \u043c\u0435\u0436\u0434\u0443 \u043a\u043b\u0438\u0435\u043d\u0442\u0430\u043c\u0438 \u0447\u0435\u0440\u0435\u0437 \u0441\u0438\u0433\u043d\u0430\u043b\u044c\u043d\u044b\u0439 \u0441\u0435\u0440\u0432\u0435\u0440. \u041e\u0434\u0438\u043d \u043a\u043b\u0438\u0435\u043d\u0442 \u0441\u043e\u0437\u0434\u0430\u0451\u0442 <strong>&#171;offer&#187;,<\/strong> \u0432\u0442\u043e\u0440\u043e\u0439 \u043e\u0442\u0432\u0435\u0447\u0430\u0435\u0442 <strong>&#171;answer&#187;<\/strong>. \u0412\u043d\u0443\u0442\u0440\u0438 \u2014 \u0432\u0441\u0451: \u043e\u0442 \u0442\u0438\u043f\u0430 \u043c\u0435\u0434\u0438\u0430\u043f\u043e\u0442\u043e\u043a\u0430 \u0434\u043e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u043e \u0441\u0435\u0442\u0438.<\/p>\n<p>\u041f\u0440\u0438\u043c\u0435\u0440 <code>SDP offer<\/code> \u043c\u043e\u0436\u0435\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u0442\u0430\u043a (\u0441\u0438\u043b\u044c\u043d\u043e \u0443\u043f\u0440\u043e\u0449\u0451\u043d\u043d\u043e):<\/p>\n<pre><code class=\"typescript\">v=0 o=- 123456 2 IN IP4 192.0.2.1 s=- t=0 0 m=audio 49170 RTP\/AVP 0 c=IN IP4 192.0.2.1 a=rtpmap:0 PCMU\/8000<\/code><\/pre>\n<p><strong>ICE (Interactive Connectivity Establishment)<\/strong> \u2014 \u044d\u0442\u043e \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u043f\u043e\u0438\u0441\u043a\u0430 \u043f\u0443\u0442\u0438 \u0434\u043b\u044f \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f \u043c\u0435\u0436\u0434\u0443 \u043a\u043b\u0438\u0435\u043d\u0442\u0430\u043c\u0438. \u0422\u0430\u043a \u043a\u0430\u043a \u043e\u0431\u0430 \u043c\u043e\u0433\u0443\u0442 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u044c\u0441\u044f \u0437\u0430 NAT, \u0438\u043c \u043d\u0443\u0436\u043d\u043e &#171;\u0432\u044b\u0447\u0438\u0441\u043b\u0438\u0442\u044c&#187;, \u043a\u0430\u043a \u0434\u043e\u0441\u0442\u0443\u0447\u0430\u0442\u044c\u0441\u044f \u0434\u0440\u0443\u0433 \u0434\u043e \u0434\u0440\u0443\u0433\u0430: \u043d\u0430\u043f\u0440\u044f\u043c\u0443\u044e, \u0447\u0435\u0440\u0435\u0437 \u043f\u0440\u043e\u043c\u0435\u0436\u0443\u0442\u043e\u0447\u043d\u044b\u0435 \u0430\u0434\u0440\u0435\u0441\u0430 \u0438\u043b\u0438 \u0447\u0435\u0440\u0435\u0437 TURN-\u0441\u0435\u0440\u0432\u0435\u0440.<\/p>\n<p>\u041f\u0440\u0438\u043c\u0435\u0440 ICE-\u043a\u0430\u043d\u0434\u0438\u0434\u0430\u0442\u0430:<\/p>\n<pre><code class=\"json\">{   \"candidate\": \"candidate:842163049 1 udp 1677729535 192.0.2.3 54874 typ srflx raddr 10.0.0.2 rport 54874\",   \"sdpMid\": \"0\",   \"sdpMLineIndex\": 0 }<\/code><\/pre>\n<ul>\n<li>\n<p><code>candidate<\/code>: \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u0430 (IP, \u043f\u043e\u0440\u0442, \u0442\u0438\u043f \u2014 <code>host<\/code>, <code>srflx<\/code>, <code>relay<\/code>);<\/p>\n<\/li>\n<li>\n<p><code>sdpMid<\/code>: ID \u043c\u0435\u0434\u0438\u0430\u043b\u0438\u043d\u0438\u0438 (\u0430\u0443\u0434\u0438\u043e\/\u0432\u0438\u0434\u0435\u043e);<\/p>\n<\/li>\n<li>\n<p><code>sdpMLineIndex<\/code>: \u0438\u043d\u0434\u0435\u043a\u0441 \u043c\u0435\u0434\u0438\u0430\u043b\u0438\u043d\u0438\u0438 (0 \u2014 \u043e\u0431\u044b\u0447\u043d\u043e \u0430\u0443\u0434\u0438\u043e, 1 \u2014 \u0432\u0438\u0434\u0435\u043e \u0438 \u0442.\u043f.).<\/p>\n<\/li>\n<\/ul>\n<p>\u041a\u0430\u0436\u0434\u044b\u0439 \u043a\u043b\u0438\u0435\u043d\u0442 \u0441\u043e\u0431\u0438\u0440\u0430\u0435\u0442 \u0441\u043f\u0438\u0441\u043e\u043a \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u0445 \u0430\u0434\u0440\u0435\u0441\u043e\u0432 (ICE-\u043a\u0430\u043d\u0434\u0438\u0434\u0430\u0442\u043e\u0432) \u0438 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442 \u0438\u0445 \u0434\u0440\u0443\u0433\u043e\u043c\u0443. \u0417\u0430\u0442\u0435\u043c WebRTC \u043f\u0440\u043e\u0431\u0443\u0435\u0442 \u0441\u043e\u0435\u0434\u0438\u043d\u0438\u0442\u044c\u0441\u044f \u043f\u043e \u043d\u0438\u043c \u0432 \u043f\u043e\u0440\u044f\u0434\u043a\u0435 \u043f\u0440\u0438\u043e\u0440\u0438\u0442\u0435\u0442\u0430 \u2014 \u0438 \u0432\u044b\u0431\u0438\u0440\u0430\u0435\u0442 \u043b\u0443\u0447\u0448\u0438\u0439.<\/p>\n<h4>\u041a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u044b<\/h4>\n<p>\u0427\u0442\u043e\u0431\u044b \u0432\u0441\u0451 \u0437\u0430\u0440\u0430\u0431\u043e\u0442\u0430\u043b\u043e, \u043d\u0430\u043c \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u044f\u0442\u0441\u044f:<\/p>\n<ol>\n<li>\n<p>\u0421\u0438\u0433\u043d\u0430\u043b\u044c\u043d\u044b\u0439 \u0441\u0435\u0440\u0432\u0435\u0440 \u2014 \u0434\u043b\u044f \u043f\u0435\u0440\u0432\u043e\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u043e\u0431\u043c\u0435\u043d\u0430 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0435\u0439 \u043c\u0435\u0436\u0434\u0443 \u043a\u043b\u0438\u0435\u043d\u0442\u0430\u043c\u0438. WebRTC \u043d\u0435 \u0432\u043a\u043b\u044e\u0447\u0430\u0435\u0442 \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c \u0441\u0438\u0433\u043d\u0430\u043b\u0438\u043d\u0433\u0430, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043c\u044b \u0441\u0430\u043c\u0438 \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u0443\u0435\u043c \u043e\u0431\u043c\u0435\u043d: <\/p>\n<ul>\n<li>\n<p>\u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435\u043c \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f (SDP),<\/p>\n<\/li>\n<li>\n<p>\u0438 \u0441\u0435\u0442\u0435\u0432\u044b\u043c\u0438 \u0430\u0434\u0440\u0435\u0441\u0430\u043c\u0438 (ICE-\u043a\u0430\u043d\u0434\u0438\u0434\u0430\u0442\u0430\u043c\u0438).<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p>\u041e\u0431\u044b\u0447\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442 WebSocket \u0438\u043b\u0438 \u043b\u044e\u0431\u0443\u044e \u0434\u0440\u0443\u0433\u0443\u044e \u0434\u0432\u0443\u0441\u0442\u043e\u0440\u043e\u043d\u043d\u044e\u044e \u0441\u0432\u044f\u0437\u044c.<\/p>\n<\/li>\n<li>\n<p>STUN-\u0441\u0435\u0440\u0432\u0435\u0440 \u2014 \u043f\u043e\u043c\u043e\u0433\u0430\u0435\u0442 \u043a\u043b\u0438\u0435\u043d\u0442\u0430\u043c \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u0441\u0432\u043e\u0438 \u0432\u043d\u0435\u0448\u043d\u0438\u0435 IP-\u0430\u0434\u0440\u0435\u0441\u0430 \u0438 \u043f\u043e\u0440\u0442\u044b \u0437\u0430 NAT. \u042d\u0442\u043e \u0431\u0435\u0441\u043f\u043b\u0430\u0442\u043d\u043e \u0438 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0432 \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u0435 \u0441\u043b\u0443\u0447\u0430\u0435\u0432.<\/p>\n<\/li>\n<li>\n<p>TURN-\u0441\u0435\u0440\u0432\u0435\u0440 \u2014 \u0435\u0441\u043b\u0438 \u043f\u0440\u044f\u043c\u043e\u0435 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 \u043d\u0435 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f (\u0436\u0451\u0441\u0442\u043a\u0438\u0439 NAT, \u043a\u043e\u0440\u043f\u043e\u0440\u0430\u0442\u0438\u0432\u043d\u044b\u0435 \u0441\u0435\u0442\u0438), \u0442\u0440\u0430\u0444\u0438\u043a \u0438\u0434\u0451\u0442 \u0447\u0435\u0440\u0435\u0437 \u043f\u0440\u043e\u043c\u0435\u0436\u0443\u0442\u043e\u0447\u043d\u044b\u0439 \u0441\u0435\u0440\u0432\u0435\u0440. \u042d\u0442\u043e \u0434\u043e\u0440\u043e\u0436\u0435, \u043d\u043e \u043d\u0430\u0434\u0451\u0436\u043d\u0435\u0435.<\/p>\n<\/li>\n<li>\n<p>\u041a\u043b\u0438\u0435\u043d\u0442\u044b \u2014 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u044e\u0442 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435, \u043f\u043e\u043b\u0443\u0447\u0430\u044e\u0442 \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u043a\u0430\u043c\u0435\u0440\u0435\/\u043c\u0438\u043a\u0440\u043e\u0444\u043e\u043d\u0443, \u043e\u0431\u043c\u0435\u043d\u0438\u0432\u0430\u044e\u0442\u0441\u044f \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u0438 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u044e\u0442 \u0432\u0438\u0434\u0435\u043e.<\/p>\n<\/li>\n<\/ol>\n<h4>\u041f\u043e\u0442\u043e\u043a \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0439<\/h4>\n<ol>\n<li>\n<p>\u041a\u043b\u0438\u0435\u043d\u0442 A \u0438\u043d\u0438\u0446\u0438\u0438\u0440\u0443\u0435\u0442 \u0437\u0432\u043e\u043d\u043e\u043a \u2192 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442 SDP \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440.<\/p>\n<\/li>\n<li>\n<p>\u0421\u0435\u0440\u0432\u0435\u0440 \u043f\u0435\u0440\u0435\u0441\u044b\u043b\u0430\u0435\u0442 SDP \u041a\u043b\u0438\u0435\u043d\u0442\u0443 B.<\/p>\n<\/li>\n<li>\n<p>\u041a\u043b\u0438\u0435\u043d\u0442 B \u043e\u0442\u0432\u0435\u0447\u0430\u0435\u0442 \u0441\u0432\u043e\u0438\u043c SDP.<\/p>\n<\/li>\n<li>\n<p>\u041e\u0431\u0430 \u043a\u043b\u0438\u0435\u043d\u0442\u0430 \u043e\u0431\u043c\u0435\u043d\u0438\u0432\u0430\u044e\u0442\u0441\u044f ICE-\u043a\u0430\u043d\u0434\u0438\u0434\u0430\u0442\u0430\u043c\u0438 \u2014 \u044d\u0442\u043e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f \u043e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u0445 \u043f\u0443\u0442\u044f\u0445 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f.<\/p>\n<\/li>\n<li>\n<p>WebRTC \u0432\u044b\u0431\u0438\u0440\u0430\u0435\u0442 \u043b\u0443\u0447\u0448\u0438\u0439 \u043f\u0443\u0442\u044c (\u043d\u0430\u043f\u0440\u044f\u043c\u0443\u044e, \u0447\u0435\u0440\u0435\u0437 STUN \u0438\u043b\u0438 \u0447\u0435\u0440\u0435\u0437 TURN).<\/p>\n<\/li>\n<li>\n<p>\u041f\u043e\u0442\u043e\u043a \u0432\u0438\u0434\u0435\u043e\/\u0430\u0443\u0434\u0438\u043e \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442 \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0442\u044c\u0441\u044f \u043d\u0430\u043f\u0440\u044f\u043c\u0443\u044e (\u0435\u0441\u043b\u0438 \u043f\u043e\u0432\u0435\u0437\u0451\u0442) \u0438\u043b\u0438 \u0447\u0435\u0440\u0435\u0437 TURN.<\/p>\n<\/li>\n<\/ol>\n<figure class=\"full-width\">\n<div><figcaption>\u0421\u0445\u0435\u043c\u0430 WebRTC \u0437\u0432\u043e\u043d\u043a\u0430<\/figcaption><\/div>\n<\/figure>\n<h4>STUN \u0438 TURN: \u043f\u043e\u043c\u043e\u0449\u043d\u0438\u043a\u0438 \u0432 \u043c\u0438\u0440\u0435 NAT&#8217;\u043e\u0432<\/h4>\n<p>\u0412 \u0438\u0434\u0435\u0430\u043b\u044c\u043d\u043e\u043c \u043c\u0438\u0440\u0435 \u0434\u0432\u0430 \u043a\u043b\u0438\u0435\u043d\u0442\u0430 \u0441\u043e\u0435\u0434\u0438\u043d\u044f\u044e\u0442\u0441\u044f \u043d\u0430\u043f\u0440\u044f\u043c\u0443\u044e. \u041d\u043e \u0432 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u043e\u0431\u0430 \u0447\u0430\u0441\u0442\u043e \u043d\u0430\u0445\u043e\u0434\u044f\u0442\u0441\u044f \u0437\u0430 NAT&#8217;\u0430\u043c\u0438 \u2014 \u0440\u043e\u0443\u0442\u0435\u0440\u0430\u043c\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0441\u043a\u0440\u044b\u0432\u0430\u044e\u0442 \u0438\u0445 \u043d\u0430\u0441\u0442\u043e\u044f\u0449\u0438\u0435 IP-\u0430\u0434\u0440\u0435\u0441\u0430. \u0418 \u0442\u0443\u0442 \u043d\u0430 \u043f\u043e\u043c\u043e\u0449\u044c \u043f\u0440\u0438\u0445\u043e\u0434\u044f\u0442 STUN \u0438 TURN.<\/p>\n<p><strong>STUN (Session Traversal Utilities for NAT)<\/strong> \u2014 \u044d\u0442\u043e \u043b\u0451\u0433\u043a\u0438\u0439 \u0441\u0435\u0440\u0432\u0435\u0440, \u043a \u043a\u043e\u0442\u043e\u0440\u043e\u043c\u0443 \u043a\u043b\u0438\u0435\u043d\u0442 \u043e\u0431\u0440\u0430\u0449\u0430\u0435\u0442\u0441\u044f, \u0447\u0442\u043e\u0431\u044b \u0443\u0437\u043d\u0430\u0442\u044c \u0441\u0432\u043e\u0439 <em>\u043f\u0443\u0431\u043b\u0438\u0447\u043d\u044b\u0439 IP \u0438 \u043f\u043e\u0440\u0442<\/em>. \u041f\u043e\u043b\u0443\u0447\u0438\u0432 \u044d\u0442\u0443 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e, \u043a\u043b\u0438\u0435\u043d\u0442 \u043c\u043e\u0436\u0435\u0442 \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u044c \u0435\u0451 \u0434\u0440\u0443\u0433\u043e\u043c\u0443 \u0443\u0447\u0430\u0441\u0442\u043d\u0438\u043a\u0443 \u0437\u0432\u043e\u043d\u043a\u0430 \u043a\u0430\u043a \u043e\u0434\u0438\u043d \u0438\u0437 ICE-\u043a\u0430\u043d\u0434\u0438\u0434\u0430\u0442\u043e\u0432. STUN \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0431\u044b\u0441\u0442\u0440\u043e \u0438 \u0431\u0435\u0441\u043f\u043b\u0430\u0442\u043d\u043e, \u0438 \u044d\u0442\u043e\u0433\u043e \u0447\u0430\u0441\u0442\u043e \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e, \u0435\u0441\u043b\u0438 \u0445\u043e\u0442\u044f \u0431\u044b \u043e\u0434\u0438\u043d \u043a\u043b\u0438\u0435\u043d\u0442 \u043d\u0435 \u0437\u0430 \u0436\u0451\u0441\u0442\u043a\u0438\u043c NAT.<\/p>\n<p><strong>TURN (Traversal Using Relays around NAT)<\/strong> \u2014 \u0440\u0435\u0437\u0435\u0440\u0432\u043d\u044b\u0439 \u043f\u043b\u0430\u043d. \u0415\u0441\u043b\u0438 \u043d\u0430\u043f\u0440\u044f\u043c\u0443\u044e \u0441\u043e\u0435\u0434\u0438\u043d\u0438\u0442\u044c\u0441\u044f \u043d\u0435 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043e\u0431\u0430 \u043a\u043b\u0438\u0435\u043d\u0442\u0430 \u0441\u0438\u0434\u044f\u0442 \u0437\u0430 \u0441\u0438\u043c\u043c\u0435\u0442\u0440\u0438\u0447\u043d\u044b\u043c\u0438 NAT&#8217;\u0430\u043c\u0438 \u0438\u043b\u0438 \u0432 \u043a\u043e\u0440\u043f\u043e\u0440\u0430\u0442\u0438\u0432\u043d\u044b\u0445 \u0441\u0435\u0442\u044f\u0445), TURN-\u0441\u0435\u0440\u0432\u0435\u0440 \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f \u043f\u043e\u0441\u0440\u0435\u0434\u043d\u0438\u043a\u043e\u043c: \u043e\u043d \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u0442\u0440\u0430\u0444\u0438\u043a \u043e\u0442 \u043e\u0434\u043d\u043e\u0433\u043e \u043a\u043b\u0438\u0435\u043d\u0442\u0430 \u0438 \u043f\u0435\u0440\u0435\u0441\u044b\u043b\u0430\u0435\u0442 \u0434\u0440\u0443\u0433\u043e\u043c\u0443. \u042d\u0442\u043e \u043c\u0435\u0434\u043b\u0435\u043d\u043d\u0435\u0435 \u0438 \u0434\u043e\u0440\u043e\u0436\u0435 (\u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u043c\u043e\u0449\u043d\u044b\u0439 \u0441\u0435\u0440\u0432\u0435\u0440 \u0441 \u0445\u043e\u0440\u043e\u0448\u0438\u043c \u043a\u0430\u043d\u0430\u043b\u043e\u043c), \u043d\u043e \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0432\u0430\u0435\u0442 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 \u0432 100% \u0441\u043b\u0443\u0447\u0430\u0435\u0432.<\/p>\n<p>\ud83d\udccc \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0445\u043e\u0440\u043e\u0448\u0430\u044f \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044f WebRTC \u0432\u0441\u0435\u0433\u0434\u0430 \u0432\u043a\u043b\u044e\u0447\u0430\u0435\u0442 <strong>\u043e\u0431\u0430<\/strong> \u0441\u0435\u0440\u0432\u0435\u0440\u0430:<\/p>\n<figure class=\"full-width\">\n<div><figcaption>\u0421\u0432\u044f\u0437\u044c \u0447\u0435\u0440\u0435\u0437 TURN \u0441\u0435\u0440\u0432\u0435\u0440<\/figcaption><\/div>\n<\/figure>\n<h3>\u041f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u043c \u043a \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438<\/h3>\n<p>\u041c\u044b \u0443\u0436\u0435 \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u043b\u0438\u0441\u044c, \u043a\u0430\u043a \u0443\u0441\u0442\u0440\u043e\u0435\u043d WebRTC: \u0447\u0442\u043e \u0442\u0430\u043a\u043e\u0435 SDP, ICE, STUN \u0438 TURN, \u0437\u0430\u0447\u0435\u043c \u043d\u0443\u0436\u0435\u043d \u0441\u0438\u0433\u043d\u0430\u043b\u044c\u043d\u044b\u0439 \u0441\u0435\u0440\u0432\u0435\u0440 \u0438 \u043a\u0430\u043a \u0441\u0442\u0440\u043e\u0438\u0442\u0441\u044f \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435. \u0422\u0435\u043f\u0435\u0440\u044c \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u0435\u0440\u0435\u0439\u0434\u0451\u043c \u043a \u0441\u0430\u043c\u043e\u043c\u0443 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e\u043c\u0443 \u2014 <strong>\u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0432\u0438\u0434\u0435\u043e\u0437\u0432\u043e\u043d\u043a\u043e\u0432 \u0432 \u043d\u0430\u0448\u0435\u043c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438 \u043d\u0430 React Native<\/strong>. \u041c\u044b \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 <a href=\"https:\/\/github.com\/react-native-webrtc\/react-native-webrtc\" rel=\"noopener noreferrer nofollow\"><code>react-native-webrtc<\/code><\/a> \u2014 \u044d\u0442\u043e \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u0430\u044f \u043e\u0431\u0451\u0440\u0442\u043a\u0430 \u043d\u0430\u0434 WebRTC API \u0434\u043b\u044f React Native. \u041e\u043d\u0430 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u043c\u0435\u0434\u0438\u0430\u043f\u043e\u0442\u043e\u043a\u0430\u043c\u0438, \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f, \u0441\u043b\u0443\u0448\u0430\u0442\u044c \u0441\u043e\u0431\u044b\u0442\u0438\u044f ICE-\u043a\u0430\u043d\u0434\u0438\u0434\u0430\u0442\u043e\u0432 \u0438 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0442\u044c \u0432\u0438\u0434\u0435\u043e \u043f\u0440\u044f\u043c\u043e \u0432 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438.<\/p>\n<p>\u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0441\u0438\u0433\u043d\u0430\u043b\u044c\u043d\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u043c\u044b \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c graphql \u0431\u0435\u043a\u0435\u043d\u0434 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u0432 \u043f\u0440\u043e\u0448\u043b\u043e\u0439 \u0447\u0430\u0441\u0442\u0438. \u0414\u043e\u0431\u0430\u0432\u0438\u043c \u0432 \u043d\u0435\u0433\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u043f\u0435\u0440\u0435\u0441\u044b\u043b\u043a\u0438 \u0441\u0438\u0433\u043d\u0430\u043b\u043e\u0432 \u043c\u0435\u0436\u0434\u0443 \u043a\u043b\u0438\u0435\u043d\u0442\u0430\u043c\u0438:<\/p>\n<pre><code class=\"json\">type CallSignal { \u00a0type: CallSignalType!  # \u0422\u0438\u043f \u0441\u0438\u0433\u043d\u0430\u043b\u0430: OFFER, ANSWER, ICE_CANDIDATE \u0438 \u0442.\u043f. \u00a0payload: String!       # \u0421\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u0441\u0438\u0433\u043d\u0430\u043b\u0430 \u2014 \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, SDP \u0438\u043b\u0438 ICE-\u043a\u0430\u043d\u0434\u0438\u0434\u0430\u0442 (\u0432 \u0432\u0438\u0434\u0435 \u0441\u0442\u0440\u043e\u043a\u0438) \u00a0chatID: String!        # ID \u0447\u0430\u0442\u0430 (\u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u043a\u0430\u043a \"\u043a\u043e\u043c\u043d\u0430\u0442\u0430\" \u0434\u043b\u044f \u0437\u0432\u043e\u043d\u043a\u0430) }        input CallSignalInput { \u00a0type: CallSignalType!  # \u0422\u0438\u043f \u0441\u0438\u0433\u043d\u0430\u043b\u0430 \u00a0payload: String!       # \u0421\u0430\u043c \u0441\u0438\u0433\u043d\u0430\u043b (JSON-\u0441\u0442\u0440\u043e\u043a\u0430) \u00a0chatID: String!        # \u041a \u043a\u0430\u043a\u043e\u043c\u0443 \u0447\u0430\u0442\u0443\/\u0440\u0430\u0437\u0433\u043e\u0432\u043e\u0440\u0443 \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0441\u044f }  type Mutation { \u00a0sendCallSignal(input: CallSignalInput!): Boolean! \u00a0endCall(chatID: String!): Boolean! }  type Subscription { \u00a0callSignalReceived(chatID: String!): CallSignal! \u00a0callEnded(chatID: String!): Boolean! }<\/code><\/pre>\n<p>\u0412\u0441\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u044b \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 <strong>WebRTC<\/strong> \u0432 <strong>react-native<\/strong> \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u0441\u044f \u0432 \u043f\u0430\u043a\u0435\u0442\u0435 <strong>react-native-webrtc<\/strong>.<\/p>\n<p>\u0414\u043b\u044f \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 WebRTC \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f \u043d\u0443\u0436\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043e\u0431\u044a\u0435\u043a\u0442 \u0442\u0438\u043f\u0430 RTCPeerConnection \u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u044c \u0435\u043c\u0443 \u043d\u0430\u0448\u0438 STUN \u0438 TURN \u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432.<\/p>\n<pre><code class=\"typescript\">const pc = new RTCPeerConnection({   iceServers: [     { urls: 'stun:stun.l.google.com:19302' },     {       urls: 'turn:your.turn.server:3478',       username: 'user',       credential: 'password'     }   ] });<\/code><\/pre>\n<p>STUN \u043f\u0440\u043e\u0431\u0443\u0435\u0442 \u043f\u0435\u0440\u0432\u044b\u043c. \u0415\u0441\u043b\u0438 \u043d\u0435 \u0441\u0440\u0430\u0431\u043e\u0442\u0430\u043b\u043e \u2014 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f TURN. \u0412\u0441\u0451 \u044d\u0442\u043e \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u043f\u0440\u043e\u0437\u0440\u0430\u0447\u043d\u043e \u0434\u043b\u044f \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430, \u043d\u043e \u043a\u0440\u0438\u0442\u0438\u0447\u043d\u043e \u0434\u043b\u044f \u0441\u0442\u0430\u0431\u0438\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0432\u0438\u0434\u0435\u043e\u0437\u0432\u043e\u043d\u043a\u043e\u0432.<\/p>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043e\u0431\u044a\u0435\u043a\u0442\u0430 <strong>RTCPeerConnection<\/strong>, \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043d\u0430\u0447\u0438\u043d\u0430\u0442\u044c \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0443 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f \u043c\u0435\u0436\u0434\u0443 \u0434\u0432\u0443\u043c\u044f \u043a\u043b\u0438\u0435\u043d\u0442\u0430\u043c\u0438. \u042d\u0442\u043e\u0442 \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0432\u043a\u043b\u044e\u0447\u0430\u0435\u0442 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0448\u0430\u0433\u043e\u0432:<\/p>\n<h4>\u0413\u0434\u0435 \u0432\u0437\u044f\u0442\u044c STUN \u0438 \u043a\u0430\u043a \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0441\u0432\u043e\u0439 TURN<\/h4>\n<h4>\u0411\u0435\u0441\u043f\u043b\u0430\u0442\u043d\u044b\u0435 STUN-\u0441\u0435\u0440\u0432\u0435\u0440\u044b<\/h4>\n<p>\u0414\u043b\u044f \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0438 \u043f\u0440\u043e\u0442\u043e\u0442\u0438\u043f\u043e\u0432 \u043c\u043e\u0436\u043d\u043e \u0441\u043c\u0435\u043b\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043f\u0443\u0431\u043b\u0438\u0447\u043d\u044b\u0435 STUN-\u0441\u0435\u0440\u0432\u0435\u0440\u044b:<\/p>\n<ul>\n<li>\n<p><code>stun:stun.l.google.com:19302<\/code><\/p>\n<\/li>\n<li>\n<p><code>stun:stun1.l.google.com:19302<\/code><\/p>\n<\/li>\n<li>\n<p><code>stun:stun.stunprotocol.org:3478<\/code><\/p>\n<\/li>\n<\/ul>\n<p>\u041e\u043d\u0438 \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0442 \u0441\u0442\u0430\u0431\u0438\u043b\u044c\u043d\u043e, \u0438 \u043f\u043e\u0447\u0442\u0438 \u0432\u0441\u0435\u0433\u0434\u0430 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0442 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u043f\u0440\u044f\u043c\u043e\u0435 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435.<\/p>\n<h4>TURN-\u0441\u0435\u0440\u0432\u0435\u0440<\/h4>\n<p>\u0415\u0441\u043b\u0438 \u043e\u0431\u0430 \u043a\u043b\u0438\u0435\u043d\u0442\u0430 \u043d\u0430\u0445\u043e\u0434\u044f\u0442\u0441\u044f \u0437\u0430 <strong>\u0436\u0451\u0441\u0442\u043a\u0438\u043c\u0438 NAT&#8217;\u0430\u043c\u0438<\/strong>, \u0438\u043b\u0438 \u0432 \u043a\u043e\u0440\u043f\u043e\u0440\u0430\u0442\u0438\u0432\u043d\u043e\u0439 \u0441\u0435\u0442\u0438, \u0438\u043b\u0438 \u043c\u043e\u0431\u0438\u043b\u044c\u043d\u043e\u0439 \u0441\u0435\u0442\u0438 \u0441 CGNAT \u2014 P2P \u043f\u0440\u043e\u0441\u0442\u043e <strong>\u043d\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u0441\u044f<\/strong>. \u0418 \u0432\u043e\u0442 \u0442\u0443\u0442 \u043d\u0430 \u0441\u0446\u0435\u043d\u0443 \u0432\u044b\u0445\u043e\u0434\u0438\u0442 <strong>TURN-\u0441\u0435\u0440\u0432\u0435\u0440<\/strong>: \u043e\u043d \u0440\u0435\u0442\u0440\u0430\u043d\u0441\u043b\u0438\u0440\u0443\u0435\u0442 \u0432\u0435\u0441\u044c \u0442\u0440\u0430\u0444\u0438\u043a \u043c\u0435\u0436\u0434\u0443 \u043a\u043b\u0438\u0435\u043d\u0442\u0430\u043c\u0438.<\/p>\n<p>\u0427\u0442\u043e\u0431\u044b \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0442\u044c 100% \u0443\u0441\u043f\u0435\u0448\u043d\u044b\u0435 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f, \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e \u0432 \u043f\u0440\u043e\u0434\u0430\u043a\u0448\u0435\u043d\u0435, \u043d\u0443\u0436\u0435\u043d \u0441\u0432\u043e\u0439 TURN-\u0441\u0435\u0440\u0432\u0435\u0440. \u041e\u0434\u0438\u043d \u0438\u0437 \u0441\u0430\u043c\u044b\u0445 \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u044b\u0445 \u0438 \u0431\u0435\u0441\u043f\u043b\u0430\u0442\u043d\u044b\u0445 \u2014 <strong>coturn<\/strong>.<\/p>\n<p>\u0418\u043b\u0438 \u043c\u043e\u0436\u043d\u043e \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043e\u0434\u043d\u0438\u043c \u0438\u0437 \u043e\u0431\u043b\u0430\u0447\u043d\u044b\u0445 TURN-\u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432, \u0446\u0435\u043d\u044b \u0437\u0430\u0432\u0438\u0441\u044f\u0442 \u043e\u0442 \u0442\u0440\u0430\u0444\u0438\u043a\u0430.<\/p>\n<h4>1. \u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u043c\u0435\u0434\u0438\u0430\u043f\u043e\u0442\u043e\u043a\u0438 (\u043a\u0430\u043c\u0435\u0440\u0430 \u0438 \u043c\u0438\u043a\u0440\u043e\u0444\u043e\u043d)<\/h4>\n<p>\u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u043f\u043e\u043b\u0443\u0447\u0438\u043c \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u043a\u0430\u043c\u0435\u0440\u0435 \u0438 \u043c\u0438\u043a\u0440\u043e\u0444\u043e\u043d\u0443 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f:<\/p>\n<pre><code class=\"typescript\">\/\/ \u0418\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u0443\u0435\u043c API \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u043c\u0435\u0434\u0438\u0430-\u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430\u043c\u0438 import {     mediaDevices<\/code><\/pre>\n<\/div>\n<\/div>\n<\/div>\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-456504","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/456504","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=456504"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/456504\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=456504"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=456504"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=456504"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}