{"id":283063,"date":"2016-12-26T17:20:04","date_gmt":"2016-12-26T14:20:04","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=283063"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=283063","title":{"rendered":"Asp.Net Core, Angular 2, SignalR \u0434\u043b\u044f \u0447\u0430\u0439\u043d\u0438\u043a\u043e\u0432"},"content":{"rendered":"<p>\u0412\u0441\u0435\u043c \u043f\u0440\u0438\u0432\u0435\u0442! \u0425\u043e\u0447\u0443 \u043f\u043e\u0434\u0435\u043b\u0438\u0442\u044c\u0441\u044f \u0441\u0432\u043e\u0438\u043c \u043e\u043f\u044b\u0442\u043e\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f ASP.Net Core \u0438 Angular 2 \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c SignalR.<\/p>\n<p>  \u0411\u0443\u0434\u0443\u0447\u0438 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442\u043e\u043c 1\u0421, \u0447\u0430\u0441\u0442\u043e \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0440\u0435\u0448\u0430\u0442\u044c \u0437\u0430\u0434\u0430\u0447\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0430 1\u0421 \u0440\u0435\u0448\u0438\u0442\u044c \u0441\u043b\u043e\u0436\u043d\u043e \u0438\u043b\u0438 \u043d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e. \u041e\u0447\u0435\u043d\u044c \u043f\u043e\u043c\u043e\u0433\u0430\u0435\u0442 \u0437\u043d\u0430\u043d\u0438\u0435 .Net. \u041d\u043e \u0432\u043e\u0442, \u0447\u0442\u043e \u043a\u0430\u0441\u0430\u0435\u0442\u0441\u044f \u043a\u043b\u0438\u0435\u043d\u0442\u0441\u043a\u043e\u0439 \u0447\u0430\u0441\u0442\u0438 \u0441\u0430\u0439\u0442\u043e\u0432, \u0442\u043e \u0437\u0434\u0435\u0441\u044c \u043c\u043d\u043e\u0433\u043e \u0442\u043e\u043d\u043a\u043e\u0441\u0442\u0435\u0439 (JavaScript, CSS, JQuery \u0438\u0442\u0434), \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0431\u044b\u0441\u0442\u0440\u043e \u0437\u0430\u0431\u044b\u0432\u0430\u044e\u0442\u0441\u044f, \u0435\u0441\u043b\u0438 \u0438\u043c\u0438 \u043d\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f.<\/p>\n<p>  Angular 2 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0437\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0443\u043f\u0440\u043e\u0441\u0442\u0438\u0442\u044c \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043a\u043b\u0438\u0435\u043d\u0442\u0441\u043a\u043e\u0439 \u0447\u0430\u0441\u0442\u0438. <br \/>  \u0422\u0430\u043a TypeScript \u0437\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0431\u043b\u0438\u0436\u0435 \u043a C# (\u0438 \u0433\u043b\u0430\u0432\u043d\u043e\u0435 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0420\u0443\u0441\u043b\u0438\u0448), \u0430 \u0441 \u0448\u0430\u0431\u043b\u043e\u043d\u0430\u043c\u0438 \u043d\u0435\u0441\u043b\u043e\u0436\u043d\u043e \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u0442\u044c\u0441\u044f \u0437\u043d\u0430\u044f Razor \u0438 Xaml.<\/p>\n<p>  \u0413\u043b\u0430\u0432\u043d\u043e\u0435, \u0447\u0442\u043e \u0432\u044b \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442\u0435 \u0441 \u0434\u0430\u043d\u043d\u044b\u043c\u0438, \u043f\u043e \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0438 \u0441 WPF. \u041f\u0440\u0438 \u044d\u0442\u043e\u043c \u0435\u0441\u0442\u044c \u043a\u0443\u0447\u0430 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043e\u0432.<\/p>\n<p>   \u0425\u043e\u0447\u0443 \u043f\u043e\u0434\u0435\u043b\u0438\u0442\u044c\u0441\u044f \u0441 \u0442\u0430\u043a\u0438\u043c\u0438 \u0436\u0435 \u0431\u0435\u0434\u043e\u043b\u0430\u0433\u0430\u043c\u0438 \u043a\u0430\u043a \u044f, \u0438\u043b\u0438 \u043a\u0442\u043e \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442 \u0438\u0437\u0443\u0447\u0435\u043d\u0438\u0435 Angular 2, ASP.Net Core, \u0442\u0430\u043a \u043a\u0430\u043a \u043f\u043e\u0442\u0440\u0430\u0442\u0438\u043b \u0437\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0435 \u0432\u0440\u0435\u043c\u044f, \u043d\u0430 \u043f\u043e\u0438\u0441\u043a\u0438 \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u043e\u0432 \u0434\u043b\u044f \u0438\u0437\u0443\u0447\u0435\u043d\u0438\u044f.<\/p>\n<p>  \u0414\u043b\u044f \u0442\u0440\u0435\u043d\u0438\u0440\u043e\u0432\u043a\u0438 \u043d\u0430 \u043a\u043e\u0448\u043a\u0430\u0445 \u0431\u044b\u043b \u0432\u044b\u0431\u0440\u0430\u043d \u043c\u043e\u0439 \u043f\u0440\u043e\u0435\u043a\u0442 <a href=\"http:\/\/infostart.ru\/public\/434771\/\">1C Messenger \u0434\u043b\u044f \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0438 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439, \u0444\u0430\u0439\u043b\u043e\u0432 \u0438 \u043e\u0431\u043c\u0435\u043d\u0430 \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u043c\u0435\u0436\u0434\u0443 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f\u043c\u0438 1\u0421, \u0432\u044d\u0431 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b, \u043c\u043e\u0431\u0438\u043b\u044c\u043d\u044b\u043c\u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f\u043c\u0438 \u0430 \u043b\u044f Skype, WhatsApp<br \/>  <\/a> <br \/>   \u041f\u043e\u043a\u0430 \u043d\u0435 \u0432\u044b\u0448\u0435\u043b. Net Core 1.2 \u0438 NetStandard 2, \u0441\u0435\u0439\u0447\u0430\u0441 \u043d\u0435\u0442 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0438 \u043a\u043b\u0438\u0435\u043d\u0442\u0430 \u0434\u043b\u044f SignalR \u043f\u043e\u0434 .Net Core<\/p>\n<p>  \u0418 \u0442\u0430\u043a \u043d\u0430\u0447\u043d\u0435\u043c. \u0414\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u043d\u0430\u043c \u043f\u043e\u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f<br \/>  1. <a href=\"http:\/\/blog.stevensanderson.com\/2016\/10\/04\/angular2-template-for-visual-studio\/\">ASP.NET Core + Angular 2 \u0448\u0430\u0431\u043b\u043e\u043d \u0434\u043b\u044f Visual Studio <\/a><br \/>  2. <a href=\"http:\/\/metanit.com\/sharp\/aspnet5\/\">\u0420\u0443\u043a\u043e\u0432\u043e\u0434\u0441\u0442\u0432\u043e \u043f\u043e ASP.NET Core<br \/>  <\/a> <br \/>  3. <a href=\"http:\/\/metanit.com\/web\/angular2\/\"> \u0420\u0443\u043a\u043e\u0432\u043e\u0434\u0441\u0442\u0432\u043e \u043f\u043e Angular 2<br \/>  <\/a> <br \/>   4. <a href=\"http:\/\/metanit.com\/web\/typescript\/\">\u0420\u0443\u043a\u043e\u0432\u043e\u0434\u0441\u0442\u0432\u043e \u043f\u043e TypeScript<br \/>  <\/a> <br \/>  5. <a href=\"http:\/\/www.primefaces.org\/primeng\/#\/\"> \u041a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u044b \u043e\u0442 PrimeNG<br \/>  <\/a><br \/>   6. <a href=\"http:\/\/mybootstrap.ru\/components\/\"> \u041a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u044b Bootstrap<br \/>  <\/a><\/p>\n<p>  <a name=\"habracut\"><\/a><br \/>  ASP.NET Core + Angular 2 \u0448\u0430\u0431\u043b\u043e\u043d \u0434\u043b\u044f Visual Studio \u044d\u0442\u043e \u0447\u0443\u0434\u0435\u0441\u043d\u044b\u0439 \u0448\u0430\u0431\u043b\u043e\u043d, \u043a\u043e\u0442\u043e\u044b\u0439 \u043d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u0442 \u0432\u0430\u0448\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0434\u043b\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f ASP.Net Core \u0438 Angular 2 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u044f \u043a\u0443\u0447\u0443 json \u0444\u0430\u0439\u043b\u043e\u0432 \u0438 \u043d\u0430\u0441\u0442\u0430\u0438\u0432\u0430\u044f \u0434\u043b\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f webpack. <br \/>   \u0414\u043b\u044f \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u0441\u0442\u0430\u0442\u044c\u044e <a href=\"https:\/\/habrahabr.ru\/company\/infopulse\/blog\/305818\/\">\u0417\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c Angular2 c Visual Studio 2015<\/a><\/p>\n<p>  \u0418 \u0441\u0430\u043c\u043e\u0435 \u0433\u043b\u0430\u0432\u043d\u043e\u0435 \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0438\u0437\u043c\u0435\u043d\u044f\u0442\u044c ts \u0438 html \u0444\u0430\u0439\u043b\u044b \u0432\u043e \u0432\u0440\u0435\u043c\u044f \u043e\u0442\u043b\u0430\u0434\u043a\u0438 \u0438 \u0432\u0438\u0434\u0435\u0442\u044c \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u043f\u0440\u0438 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0438 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b. \u0417\u0430 \u044d\u0442\u043e \u043e\u0442\u0432\u0435\u0447\u0430\u0435\u0442 \u043a\u043b\u0430\u0441\u0441\u044b \u0438\u0437 Microsoft.AspNetCore.SpaServices.dll <br \/>  WebpackDevMiddlewareOptions \u0438 SpaRouteExtensions.<br \/>   \u0414\u0430 \u0434\u0430! \u041e\u0442\u043b\u0430\u0436\u0438\u0432\u0430\u0442\u044c \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0432 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0435. \u041f\u0440\u0438 \u044d\u0442\u043e\u043c Ts \u0444\u0430\u0439\u043b\u044b \u043b\u0435\u0436\u0430\u0442 \u0432 \u043f\u0430\u043f\u043a\u0435 (\u043d\u0435\u0442 \u0434\u043e\u043c\u0435\u043d\u0430)<\/p>\n<p>  \u041a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u044b \u043e\u0442 PrimeNG \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0442 \u0437\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0443\u043f\u0440\u043e\u0441\u0442\u0438\u0442\u044c \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043a\u043b\u0438\u0435\u043d\u0442\u0441\u043a\u043e\u0433\u043e \u043a\u043e\u0434\u0430. \u041a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e \u043d\u0430 \u043d\u0438\u0445 \u043c\u043e\u0436\u043d\u043e \u0438\u0437\u0443\u0447\u0438\u0442\u044c \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0445 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442 \u0438 \u043c\u043e\u0434\u0438\u0444\u0438\u0446\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0435.<\/p>\n<p>  \u041d\u0430\u0447\u043d\u0435\u043c \u0441 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0445\u0430\u0431\u0430 SignalR <a href=\"http:\/\/metanit.com\/sharp\/mvc5\/16.1.php\">metanit.com\/sharp\/mvc5\/16.1.php<\/a><\/p>\n<p>  \u0423\u0434\u043e\u0431\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0442\u0438\u043f\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u0445\u0430\u0431\u044b. <\/p>\n<pre><code class=\"cs\">public interface IHelloHub     {          \/\/ \u041d\u0430 \u043a\u043b\u0438\u0435\u043d\u0442\u0435 \u043d\u0435\u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e \u043a\u0430\u043a \u043d\u0430\u0437\u0432\u0430\u043d\u044b \u043c\u0435\u0442\u043e\u0434\u044b \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0435         \/\/\u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f Camel \u043d\u043e\u0442\u0430\u0446\u0438\u044f         \/\/ \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0432\u0441\u0435 \u043c\u0435\u0442\u043e\u0434\u044b \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u043c \u0441 \u043f\u0440\u043e\u043f\u0438\u0441\u043d\u044b\u0445 \u0431\u0443\u043a\u0432                   Task sendEcho(string str, string \u041a\u043e\u043c\u0443);                 \/\/ \u0421\u043e\u0431\u044b\u0442\u0438\u044f \u041a\u043b\u0438\u0435\u043d\u0442\u0443         \/\/ \u041d\u0443\u0436\u043d\u043e \u0443\u0447\u0438\u0442\u044b\u0432\u0430\u0442\u044c, \u0447\u0442\u043e Xamarin \u043f\u043e\u043a\u0430 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0442 \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0443 \u0442\u043e\u043b\u044c\u043a\u043e 4 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432        Task addMessage(string Name, string str, string ConnectionId);  }  <\/code><\/pre>\n<p> \u0422\u043e \u043f\u0440\u0438 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u044d\u0442\u043e\u0433\u043e \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430 \u0431\u0443\u0434\u0443 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u043c\u0435\u0442\u043e\u0434 sendEcho, <br \/>  \u041d\u043e \u0438 Clients.Others.addMessage \u0438 Clients.Client(\u041a\u043e\u043c\u0443).addMessage<\/p>\n<pre><code class=\"cs\"> public class HelloHub : Hub&lt;IHelloHub&gt;     {          \/\/ \u041e\u0442\u043f\u0440\u0430\u0432\u0438\u043c \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u0432\u0441\u0435\u043c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f\u043c, \u043a\u0440\u043e\u043c\u0435 \u043e\u0442\u0441\u044b\u043b\u0430\u044e\u0449\u0435\u0433\u043e \u0435\u0441\u043b\u0438 \u041a\u043e\u043c\u0443 \u043f\u0443\u0441\u0442\u0430\u044f \u0441\u0442\u0440\u043e\u043a\u0430         \/\/ \u0415\u0441\u043b\u0438 \u041a\u043e\u043c\u0443 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d, \u0442\u043e \u043e\u0442\u043f\u0440\u0430\u0432\u0438\u043c \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u043c\u0443 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044e \u0438 ID \u041a\u043e\u043c\u0443         public async Task sendEcho(string str, string \u041a\u043e\u043c\u0443)         {             var user = new User();             if (!\u041f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0417\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u043d(user))                 return;              if (string.IsNullOrWhiteSpace(\u041a\u043e\u043c\u0443))              await Clients.Others.addMessage(user.Name, str, user.ConnectionId);             else              await  Clients.Client(\u041a\u043e\u043c\u0443).addMessage(user.Name, str, user.ConnectionId);         } } <\/code><\/pre>\n<p>  \u041a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e \u044d\u0442\u043e\u0442 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u0443\u0434\u043e\u0431\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0432 .Net \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438, \u0438 \u043c\u043e\u0436\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043a\u043e\u0434\u043e\u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440 \u0434\u043b\u044f TypeScript \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u0441\u0435\u0440\u0432\u0438\u0441\u0430.<\/p>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u043f\u0435\u0440\u0435\u0439\u0434\u0435\u043c \u043a \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044e \u043a\u043b\u0438\u0435\u043d\u0442\u0430. <br \/>   \u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043e\u0431\u0449\u0438\u0439 \u0441\u0435\u0440\u0432\u0438\u0441 <a href=\"http:\/\/metanit.com\/web\/angular2\/4.3.php\">\u041e\u0434\u0438\u043d \u0441\u0435\u0440\u0432\u0438\u0441 \u0434\u043b\u044f \u0432\u0441\u0435\u0445 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u043e\u0432<\/a> <\/p>\n<p>  \u042d\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u0438\u0442 \u043d\u0430\u043c \u0434\u0435\u0440\u0436\u0430\u0442\u044c \u0441\u0435\u0440\u0432\u0438\u0441 \u0436\u0438\u0432\u044b\u043c \u043d\u0430 \u043f\u0440\u043e\u0442\u044f\u0436\u0435\u043d\u0438\u0438 \u0432\u0441\u0435\u0439 \u0436\u0438\u0437\u043d\u0438 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b, \u0430 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442 \u0431\u0443\u0434\u0435\u0442 \u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435, \u043f\u043e\u0441\u043b\u0435 \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u043e\u0432 \u0432\u043d\u0443\u0442\u0440\u0438 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b.<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041a\u043e\u0434 \u0441\u0435\u0440\u0432\u0438\u0441\u0430 SignalR<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code>\/\/\/ &lt;reference path=&quot;..\/models\/ForHelloHub.ts&quot;\/&gt; import { IHelloHub, DataInfo, ChatMessage, User}  from &quot;..\/models\/ForHelloHub&quot;; import { EventEmitter } from '@angular\/core'; import { SelectItem } from 'primeng\/primeng'; declare var $: any;  export class HelloHub implements IHelloHub {     \/\/ \u0412\u0441\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f     public allMessages: ChatMessage[];     \/\/ \u0424\u043b\u0430\u0433 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u043a \u0425\u0430\u0431\u0443     public connectionExists: Boolean;     \/\/ \u041f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0437\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u043b \u0438\u043c\u044f     public isRegistered: Boolean;     \/\/ $.connection.helloHub.server     private server: any;      \/\/ $.connection.helloHub.client     private client: any;     \/\/ $.connection.helloHub     private chat: any;      \/\/ ID \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f     private userId: string;     \/\/ \u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u043d\u044b\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0438     public Users: SelectItem[];     \/\/ \u0421\u043e\u0431\u044b\u0442\u0438\u0435 \u043e\u0431 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0438 \u0441\u043f\u0438\u0441\u043a\u0430 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439     public onChangeUser: EventEmitter&lt;void&gt; = new EventEmitter&lt;void&gt;();      \/\/ \u0421\u043e\u0431\u044b\u0442\u0438\u0435 \u043e \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0438 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f     public onAddMessage: EventEmitter&lt;void&gt; = new EventEmitter&lt;void&gt;();     \/\/ \u0421\u043e\u0431\u044b\u0442\u0438\u0435 \u043e \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0438 \u043a \u0445\u0430\u0431\u0443     public onConnected: EventEmitter&lt;void&gt; = new EventEmitter&lt;void&gt;();     \/\/ \u0421\u043e\u0431\u044b\u0442\u0438\u0435 \u043e \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u0438 \u0438\u043c\u0435\u043d\u0442 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f.     public onRegistered: EventEmitter&lt;void&gt; = new EventEmitter&lt;void&gt;();      constructor() {         this.userId = &quot;&quot;;         \/\/ \u0423\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043c \u043d\u0430\u0447\u0430\u043b\u044c\u043d\u044b\u0439 \u0441\u043f\u0438\u0441\u043e\u043a \u0441 \u0438\u043c\u0435\u043d\u0435\u043c &quot;\u0412\u0441\u0435\u043c&quot;. \u041f\u0440\u0438 \u0435\u0433\u043e \u0432\u044b\u0431\u043e\u0440\u0435         \/\/ \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u0431\u0443\u0434\u0443\u0442 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u044b \u0432\u0441\u0435\u043c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f\u043c, \u043a\u0440\u043e\u043c\u0435 \u0442\u0435\u043a\u0443\u0449\u0435\u0433\u043e         this.Users = [{ label: &quot;\u0412\u0441\u0435\u043c&quot;, value: &quot;&quot;}];         this.connectionExists = false;         this.isRegistered = false;          this.chat = $.connection.helloHub;         this.server = this.chat.server;         this.client = this.chat.client;          \/\/ \u0423\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043c \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438 \u0441\u043e\u0431\u044b\u0442\u0438\u0439         this.registerOnServerEvents();         this.allMessages = new Array&lt;ChatMessage&gt;();          \/\/ \u041f\u043e\u0434\u0441\u043e\u0435\u0434\u0438\u043d\u0438\u043c\u0441\u044f \u043a \u0425\u0430\u0431\u0443         this.startConnection();     }       \/\/ \u0421\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u043a\u0430 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439 \u043f\u043e \u0438\u043c\u0435\u043d\u0438. \u0412\u0441\u0435\u043c \u0434\u043e\u043b\u0436\u043d\u0430 \u0431\u044b\u0442\u044c \u043f\u0435\u0440\u0432\u043e\u0439     private sortUsers() {         this.Users.sort((a, b: SelectItem) =&gt; {             if (a.label == &quot;\u0412\u0441\u0435\u043c&quot;) return -1;              return a.label.toLocaleUpperCase().localeCompare(b.label.toLocaleUpperCase());          });      }       \/\/\u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043c \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438 \u043a \u0441\u043e\u0431\u044b\u0442\u0438\u044f\u043c \u043e\u0442 \u0441\u0435\u0440\u0432\u0435\u0440\u0430     private registerOnServerEvents(): void {          let self = this;           \/\/ \u0421\u043e\u0431\u044b\u0442\u0438\u0435 \u043e \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0438 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f         \/\/Task addMessage(string Name, string str, string ConnectionId);         this.client.addMessage = (name: string, message: string, ConnectionId: string) =&gt; {             \/\/ \u0414\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439 \u043d\u0430 \u0432\u0435\u0431-\u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0443              console.log('addMessage ' + message);             self.addMessage(name, message,ConnectionId);         };          \/\/ \u0421\u043e\u0431\u044b\u0442\u0438\u0435 \u043e \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f                \/\/Task onConnected(string id, string userName, List &lt; User &gt; users);         this.client.onConnected = function (id: string, userName: string, allUsers: User[]) {             self.isRegistered = true;                self.userId = id;             \/\/ \u0414\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0432\u0441\u0435\u0445 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439             for (let user of allUsers) {                  self.addUser(user.ConnectionId, user.Name);                }              self.sortUsers();             \/\/ \u0421\u043e\u043e\u0431\u0449\u0438\u043c \u043e\u0431 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0438 \u0441\u043f\u0438\u0441\u043a\u0430 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439             self.onRegistered.emit();         };           \/\/Task onNewUserConnected(string id, string userName);         \/\/ \u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u043d\u043e\u0432\u043e\u0433\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f         this.client.onNewUserConnected = (id: string, name: string) =&gt; {              self.addUser(id, name);         };          \/\/Task onUserDisconnected(string id, string Name);         \/\/ \u0423\u0434\u0430\u043b\u044f\u0435\u043c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f        this.client.onUserDisconnected = (id: string, userName: string) =&gt; {              let idx = self.Users.findIndex((cur: SelectItem) =&gt; {                 return cur.value == id;             });              if (idx != -1) {                 return self.Users.splice(idx, 1);              };          }            }      \/\/ \u041d\u0430\u0439\u0434\u0435\u043c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u043f\u043e id     \/\/ \u0415\u0441\u043b\u0438 \u043d\u0435 \u043d\u0430\u0445\u043e\u0434\u0438\u043c \u0442\u043e \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u043d\u043e\u0432\u043e\u0433\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f     findUser(userName:string,id: string): SelectItem     {         let idx = this.Users.findIndex((cur: SelectItem) =&gt; {             return cur.value == id;         });          if (idx != -1) {             return this.Users[idx];         }         return { label: userName, value:id }               }     \/\/ \u041e\u0431\u0440\u0430\u0431\u043e\u0442\u0430\u0435\u043c \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u0441 \u0441\u0435\u0440\u0432\u0435\u0440\u0430     addMessage(name: string, message: string, ConnectionId: string): void {          this.allMessages.splice(0, 0, new ChatMessage(message, new Date, this.findUser(name, ConnectionId)));         this.onAddMessage.emit();      }       \/\/ \u0414\u043e\u0431\u0430\u0432\u0438\u043c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0438 \u043e\u0442\u0441\u043e\u0440\u0442\u0438\u0440\u0443\u0435\u043c \u043f\u043e \u043d\u0430\u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u0438\u044e     addUser(id: string, name: string): void {         if (this.userId === &quot;&quot;) return;          if (this.userId !== id) {             let usr = { label: name, value: id };             this.Users.push(usr);             this.sortUsers();             this.onChangeUser.emit();         }     }      \/\/ \u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u043c\u0441\u044f \u043a \u0425\u0430\u0431\u0443     private startConnection(): void {         let self = this;         $.connection.hub.start().done((data: any) =&gt; {             console.log('startConnection ' + data);             self.connectionExists = true;             self.onConnected.emit();             console.log('Send  onConnected');         }).fail((error) =&gt; {             console.log('Could not connect ' + error);          });     }  \/\/======= \u043c\u0435\u0442\u043e\u0434\u044b \u0438 \u0441\u043e\u0431\u044b\u0442\u0438\u044f \u0441\u0435\u0440\u0432\u0435\u0440\u0430      \/\/ \u041e\u0442\u043e\u0448\u043b\u0435\u043c \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u0412\u0441\u0435\u043c \u0438\u043b\u0438 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u043c\u0443 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044e     sendEcho(str: string, \u041a\u043e\u043c\u0443: string)     {          this.server.sendEcho(str, \u041a\u043e\u043c\u0443);     }      \/\/ \u041e\u0442\u043e\u0448\u043b\u0435\u043c \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u043f\u043e \u0438\u043c\u0435\u043d\u0438     sendByName(message: string, \u041a\u043e\u043c\u0443: string)     {          this.server.sendByName(message, \u041a\u043e\u043c\u0443);     }         \/\/ \u0417\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0435 \u043f\u043e \u0438\u043c\u0435\u043d\u0438     connect(userName: string)     {         this.server.connect(userName);      }     } <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u043f\u0435\u0440\u0435\u0439\u0434\u0435\u043c \u043a \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044e \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0430<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442 \u0434\u043b\u044f \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0445 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439 \u0438 \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0438 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code>import { Component, NgZone, ViewChild, AfterViewInit } from '@angular\/core'; import { HelloHub } from '..\/services\/HelloHubServise'; import { ChatMessage } from '..\/models\/ForHelloHub'; import { SelectItem} from 'primeng\/primeng'; import { Dropdown2 } from '..\/Dropdown\/Dropdown';   @Component({     selector: 'p-HelloHubComponent',     template: require('.\/SignalRHelloHub.html') })   export class HelloHubComponent {     @ViewChild(Dropdown2)     public dropdown: Dropdown2;      public allMessages: ChatMessage[];     public Users: SelectItem[];     public selectedUser: string;     public Message: string;     public selectUsername: boolean=false;     constructor(private _signalRService: HelloHub) {         \/\/ \u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u043c\u0441\u044f \u043a \u0441\u043e\u0431\u044b\u0442\u0438\u044f\u043c \u043e\u0442 \u0441\u0435\u0440\u0432\u0438\u0441\u0430         this.subscribeToEvents();        \/\/ \u041f\u043e\u043b\u0443\u0447\u0438\u043c \u0432\u0441\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0435 \u0437\u0430 \u0432\u0440\u0435\u043c\u044f \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043e\u0432\u0430\u043d\u0438\u044f \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b        this.allMessages = this._signalRService.allMessages;      \/\/ \u041f\u043e\u043b\u0443\u0447\u0438\u043c \u0434\u0430\u043d\u043d\u044b\u0435 \u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f\u0445         this.Users = _signalRService.Users;              }      \/\/ \u041c\u0435\u0442\u043e\u0434 \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0438 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439 \u0432\u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u0432\u044b\u0431\u0440\u0430\u043d\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445     public sendMessage() {                    if (this.dropdown.value == &quot;&quot;) \/\/ \u0415\u0441\u043b\u0438 \u0412\u044b\u0431\u0440\u0430\u043d &quot;\u0412\u0441\u0435\u043c&quot; \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u0435\u043c  \u0432\u0441\u0435\u043c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f\u043c, \u043a\u0440\u043e\u043c\u0435 \u043e\u0442\u043f\u0440\u0430\u0432\u0438\u0442\u0435\u043b\u044f         {                 this._signalRService.sendEcho(this.Message, &quot;&quot;);             }             else {             \/\/ \u0412 1\u0421 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439 \u0441 \u043e\u0434\u043d\u0438\u043c \u0438\u043c\u0435\u043d\u0435\u043c                  if (!this.selectUsername) \/\/ \u0415\u0441\u043b\u0438 \u043d\u0435 \u0441\u0442\u043e\u0438\u0442 \u0433\u0430\u043b\u043a\u0430 &quot;\u041f\u043e \u0418\u043c\u0435\u043d\u0438&quot; \u0442\u043e \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u043c\u0443 \u043c\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044e                     this._signalRService.sendEcho(this.Message, this.dropdown.value);                 else  \/\/ \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u0432\u0441\u0435\u043c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f\u043c \u0441 \u0432\u044b\u0431\u0440\u0430\u043d\u043d\u044b\u043c \u0438\u043c\u0435\u043d\u0435\u043c                     this._signalRService.sendByName(this.Message, this.dropdown.selectedOption.label);             }              this.Message = &quot;&quot;;             }      private subscribeToEvents(): void {          let self = this;             \/\/ \u041e\u0431\u043d\u043e\u0432\u0438\u043c \u0434\u0430\u043d\u043d\u044b\u0435 \u043e \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0445 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f\u0445         this._signalRService.onAddMessage.subscribe(() =&gt; {             self.allMessages = this._signalRService.allMessages;         });          \/\/ \u041e\u0431\u043d\u043e\u0432\u0438\u043c \u0434\u0430\u043d\u043d\u044b\u0435 \u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f\u0445         this._signalRService.onChangeUser.subscribe(() =&gt;         { this.Users = self._signalRService.Users; }         );     }       }<\/code><\/pre>\n<\/p><\/div>\n<\/div>\n<p>  \u041a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442 \u043f\u0440\u043e\u0441\u0442\u043e \u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0435\u0442 \u0438 \u043e\u0431\u043d\u043e\u0432\u043b\u044f\u0435\u0442 \u0434\u0430\u043d\u043d\u044b\u0435 \u043f\u043e \u0441\u043e\u0431\u044b\u0442\u0438\u044e \u0438\u0437 \u0421\u0435\u0440\u0432\u0438\u0441\u0430 \u0438 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u0447\u0435\u0440\u0435\u0437 \u043c\u0435\u0442\u043e\u0434\u044b \u0441\u0435\u0440\u0432\u0438\u0441\u0430.<br \/>   \u041d\u0443 \u0438 \u043f\u043e\u043a\u0430\u0436\u0435\u043c HTML \u043a\u043e\u0434 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0430.<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">HTML \u0448\u0430\u0431\u043b\u043e\u043d<\/b><\/p>\n<div class=\"spoiler_text\">   <\/p>\n<pre><code> &lt;div class=&quot;container&quot; id=&quot;MainMessage&quot;&gt;         &lt;form role=&quot;form&quot;  (ngSubmit)=&quot;sendMessage()&quot;&gt;              &lt;div class=&quot;form-group&quot;&gt;                 &lt;textarea type=&quot;text&quot; [(ngModel)]=&quot;Message&quot; name=&quot;Message&quot; class=&quot;form-control&quot; placeholder=&quot;\u0421\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435&quot;&gt;&lt;\/textarea&gt;             &lt;\/div&gt;              &lt;div class=&quot;form-group&quot;&gt;                 &lt;div class=&quot;btn-group open&quot;&gt;                     &lt;button  type=&quot;submit&quot; class=&quot;btn btn-info&quot;&gt;\u041e\u0442\u043f\u0440\u0430\u0432\u0438\u0442\u044c&lt;\/button&gt;                 &lt;\/div&gt;                 &lt;div class=&quot;btn-group&quot; id=&quot;users&quot;&gt;                     &lt;p-dropdown2 [options]=&quot;Users&quot; [(ngModel)]=&quot;selectedUser&quot; name=&quot;dropdownUsers&quot;&gt;&lt;\/p-dropdown2&gt;                 &lt;\/div&gt;                 &lt;div class=&quot;btn-group&quot; id=&quot;SendByName&quot;&gt;                     &lt;div class=&quot;checkbox&quot;&gt;                         &lt;label&gt;                             &lt;input type=&quot;checkbox&quot; name=&quot;CheckBoxSendByName&quot; [(ngModel)]=&quot;selectUsername&quot;  [disabled]=&quot;dropdown.value==''&quot;&gt; \u041f\u043e \u0438\u043c\u0435\u043d\u0438                         &lt;\/label&gt;                     &lt;\/div&gt;                   &lt;\/div&gt;             &lt;\/div&gt;           &lt;\/form&gt;       &lt;\/div&gt;      &lt;div class=&quot;row&quot;&gt;          &lt;div class=&quot;col-xs-12 col-md-8&quot; id=&quot;GetingMessage&quot;&gt;             &lt;template ngFor let-item [ngForOf]=&quot;allMessages&quot;&gt;                 &lt;div class='panel panel-primary'&gt;                     &lt;div class='panel-heading'&gt;                         {{item.From.label}} \u043e\u0442 {{item.Sent.toLocaleString()}}                     &lt;\/div&gt;                     &lt;div class='panel-body'&gt;                     {{item.Message}}                     &lt;\/div&gt;                 &lt;\/div&gt;             &lt;\/template&gt;         &lt;\/div&gt;         &lt;div class=&quot;col-xs-6 col-md-4&quot;&gt;          &lt;\/div&gt;     &lt;\/div&gt; <\/code><\/pre>\n<\/div>\n<\/div>\n<p>  \u0423 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u0444\u043e\u0440\u043c\u0430 \u0434\u043b\u044f \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0438 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 textarea \u0441 \u043f\u0440\u0438\u0432\u044f\u0437\u043a\u043e\u0439 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430 Message, dropdown \u0441 \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u043e \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u043d\u044b\u0445 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f\u0445, checkbox \u0441 \u043f\u0440\u0438\u044f\u0437\u043a\u043e\u0439 selectUsername \u0434\u043b\u044f \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0438 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u043f\u043e \u0438\u043c\u0435\u043d\u0438.<\/p>\n<p>  \u0418 \u0435\u0441\u0442\u044c \u0431\u043b\u043e\u043a \u0441 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u043c\u0438 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f\u043c\u0438 allMessages. <\/p>\n<p>  \u0421\u0430\u043c Html \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0441\u044f \u043a\u043e\u043c\u043f\u0430\u043a\u0442\u043d\u044b\u043c, \u0430 \u0432\u0435\u0441\u044c \u043a\u043e\u0434 \u043d\u0430 \u043e\u0447\u0435\u043d\u044c \u043f\u0440\u0438\u044f\u0442\u043d\u043e\u043c TypeScript.<\/p>\n<p>  \u041e\u0431\u0440\u0430\u0449\u0443 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043d\u0430 \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u0435 self \u0432\u043d\u0443\u0442\u0440\u0438 \u0437\u0430\u043c\u044b\u043a\u0430\u043d\u0438\u044f. \u042d\u0442\u043e \u0441\u0432\u044f\u0437\u0430\u043d\u043e \u0441 JS.<br \/>  \u0421\u0430\u043c \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440 TS \u0432 JS \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u0442  <\/p>\n<pre><code>var _this = this;<\/code><\/pre>\n<p>  \u0438 \u0437\u0430\u043c\u0435\u043d\u044f\u0435\u0442  <\/p>\n<pre><code>var transport = this.chat.transport;<\/code><\/pre>\n<p>  \u043d\u0430  <\/p>\n<pre><code>var transport = _this.chat.transport;<\/code><\/pre>\n<p>  \u041d\u043e \u0434\u043b\u044f \u043e\u0442\u043b\u0430\u0434\u043a\u0438 \u0443\u0434\u043e\u0431\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043f\u0440\u043e\u043c\u0435\u0436\u0443\u0442\u043e\u0447\u043d\u0443\u044e \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e   <\/p>\n<pre><code>  let self = this;<\/code><\/pre>\n<p>  \u0418\u0441\u0445\u043e\u0434\u043d\u0438\u043a\u0438 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c <a href=\"https:\/\/github.com\/Serginio1\/Angular2SignalrCore\">\u0417\u0434\u0435\u0441\u044c<\/a><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:\/\/habrahabr.ru\/post\/318480\/\"> https:\/\/habrahabr.ru\/post\/318480\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u0412\u0441\u0435\u043c \u043f\u0440\u0438\u0432\u0435\u0442! \u0425\u043e\u0447\u0443 \u043f\u043e\u0434\u0435\u043b\u0438\u0442\u044c\u0441\u044f \u0441\u0432\u043e\u0438\u043c \u043e\u043f\u044b\u0442\u043e\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f ASP.Net Core \u0438 Angular 2 \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c SignalR.<\/p>\n<p>  \u0411\u0443\u0434\u0443\u0447\u0438 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442\u043e\u043c 1\u0421, \u0447\u0430\u0441\u0442\u043e \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0440\u0435\u0448\u0430\u0442\u044c \u0437\u0430\u0434\u0430\u0447\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0430 1\u0421 \u0440\u0435\u0448\u0438\u0442\u044c \u0441\u043b\u043e\u0436\u043d\u043e \u0438\u043b\u0438 \u043d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e. \u041e\u0447\u0435\u043d\u044c \u043f\u043e\u043c\u043e\u0433\u0430\u0435\u0442 \u0437\u043d\u0430\u043d\u0438\u0435 .Net. \u041d\u043e \u0432\u043e\u0442, \u0447\u0442\u043e \u043a\u0430\u0441\u0430\u0435\u0442\u0441\u044f \u043a\u043b\u0438\u0435\u043d\u0442\u0441\u043a\u043e\u0439 \u0447\u0430\u0441\u0442\u0438 \u0441\u0430\u0439\u0442\u043e\u0432, \u0442\u043e \u0437\u0434\u0435\u0441\u044c \u043c\u043d\u043e\u0433\u043e \u0442\u043e\u043d\u043a\u043e\u0441\u0442\u0435\u0439 (JavaScript, CSS, JQuery \u0438\u0442\u0434), \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0431\u044b\u0441\u0442\u0440\u043e \u0437\u0430\u0431\u044b\u0432\u0430\u044e\u0442\u0441\u044f, \u0435\u0441\u043b\u0438 \u0438\u043c\u0438 \u043d\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f.<\/p>\n<p>  Angular 2 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0437\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0443\u043f\u0440\u043e\u0441\u0442\u0438\u0442\u044c \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043a\u043b\u0438\u0435\u043d\u0442\u0441\u043a\u043e\u0439 \u0447\u0430\u0441\u0442\u0438. <br \/>  \u0422\u0430\u043a TypeScript \u0437\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0431\u043b\u0438\u0436\u0435 \u043a C# (\u0438 \u0433\u043b\u0430\u0432\u043d\u043e\u0435 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0420\u0443\u0441\u043b\u0438\u0448), \u0430 \u0441 \u0448\u0430\u0431\u043b\u043e\u043d\u0430\u043c\u0438 \u043d\u0435\u0441\u043b\u043e\u0436\u043d\u043e \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u0442\u044c\u0441\u044f \u0437\u043d\u0430\u044f Razor \u0438 Xaml.<\/p>\n<p>  \u0413\u043b\u0430\u0432\u043d\u043e\u0435, \u0447\u0442\u043e \u0432\u044b \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442\u0435 \u0441 \u0434\u0430\u043d\u043d\u044b\u043c\u0438, \u043f\u043e \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0438 \u0441 WPF. \u041f\u0440\u0438 \u044d\u0442\u043e\u043c \u0435\u0441\u0442\u044c \u043a\u0443\u0447\u0430 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043e\u0432.<\/p>\n<p>   \u0425\u043e\u0447\u0443 \u043f\u043e\u0434\u0435\u043b\u0438\u0442\u044c\u0441\u044f \u0441 \u0442\u0430\u043a\u0438\u043c\u0438 \u0436\u0435 \u0431\u0435\u0434\u043e\u043b\u0430\u0433\u0430\u043c\u0438 \u043a\u0430\u043a \u044f, \u0438\u043b\u0438 \u043a\u0442\u043e \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442 \u0438\u0437\u0443\u0447\u0435\u043d\u0438\u0435 Angular 2, ASP.Net Core, \u0442\u0430\u043a \u043a\u0430\u043a \u043f\u043e\u0442\u0440\u0430\u0442\u0438\u043b \u0437\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0435 \u0432\u0440\u0435\u043c\u044f, \u043d\u0430 \u043f\u043e\u0438\u0441\u043a\u0438 \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u043e\u0432 \u0434\u043b\u044f \u0438\u0437\u0443\u0447\u0435\u043d\u0438\u044f.<\/p>\n<p>  \u0414\u043b\u044f \u0442\u0440\u0435\u043d\u0438\u0440\u043e\u0432\u043a\u0438 \u043d\u0430 \u043a\u043e\u0448\u043a\u0430\u0445 \u0431\u044b\u043b \u0432\u044b\u0431\u0440\u0430\u043d \u043c\u043e\u0439 \u043f\u0440\u043e\u0435\u043a\u0442 <a href=\"http:\/\/infostart.ru\/public\/434771\/\">1C Messenger \u0434\u043b\u044f \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0438 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439, \u0444\u0430\u0439\u043b\u043e\u0432 \u0438 \u043e\u0431\u043c\u0435\u043d\u0430 \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u043c\u0435\u0436\u0434\u0443 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f\u043c\u0438 1\u0421, \u0432\u044d\u0431 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b, \u043c\u043e\u0431\u0438\u043b\u044c\u043d\u044b\u043c\u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f\u043c\u0438 \u0430 \u043b\u044f Skype, WhatsApp<br \/>  <\/a> <br \/>   \u041f\u043e\u043a\u0430 \u043d\u0435 \u0432\u044b\u0448\u0435\u043b. Net Core 1.2 \u0438 NetStandard 2, \u0441\u0435\u0439\u0447\u0430\u0441 \u043d\u0435\u0442 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0438 \u043a\u043b\u0438\u0435\u043d\u0442\u0430 \u0434\u043b\u044f SignalR \u043f\u043e\u0434 .Net Core<\/p>\n<p>  \u0418 \u0442\u0430\u043a \u043d\u0430\u0447\u043d\u0435\u043c. \u0414\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u043d\u0430\u043c \u043f\u043e\u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f<br \/>  1. <a href=\"http:\/\/blog.stevensanderson.com\/2016\/10\/04\/angular2-template-for-visual-studio\/\">ASP.NET Core + Angular 2 \u0448\u0430\u0431\u043b\u043e\u043d \u0434\u043b\u044f Visual Studio <\/a><br \/>  2. <a href=\"http:\/\/metanit.com\/sharp\/aspnet5\/\">\u0420\u0443\u043a\u043e\u0432\u043e\u0434\u0441\u0442\u0432\u043e \u043f\u043e ASP.NET Core<br \/>  <\/a> <br \/>  3. <a href=\"http:\/\/metanit.com\/web\/angular2\/\"> \u0420\u0443\u043a\u043e\u0432\u043e\u0434\u0441\u0442\u0432\u043e \u043f\u043e Angular 2<br \/>  <\/a> <br \/>   4. <a href=\"http:\/\/metanit.com\/web\/typescript\/\">\u0420\u0443\u043a\u043e\u0432\u043e\u0434\u0441\u0442\u0432\u043e \u043f\u043e TypeScript<br \/>  <\/a> <br \/>  5. <a href=\"http:\/\/www.primefaces.org\/primeng\/#\/\"> \u041a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u044b \u043e\u0442 PrimeNG<br \/>  <\/a><br \/>   6. <a href=\"http:\/\/mybootstrap.ru\/components\/\"> \u041a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u044b Bootstrap<br \/>  <\/a><\/p>\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-283063","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/283063","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=283063"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/283063\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=283063"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=283063"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=283063"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}