技术控

    今日:151| 主题:49194
收藏本版 (1)
最新软件应用技术尽在掌握

[其他] Real-time applications using ASP.NET Core, SignalR & Angular

[复制链接]
Lonelypartn 发表于 2016-10-10 19:51:18
122 3

立即注册CoLaBug.com会员,免费获得投稿人的专业资料,享用更多功能,玩转个人品牌!

您需要 登录 才可以下载或查看,没有帐号?立即注册

x
Real-time web applications are apps that push user experience to the limits while trying to immediately reflect data changes to a great number of connected clients. You make use of such applications on a daily basis, Facebook and Twitter are some of them. There are several ways to design and implement Real-time web applications and of course Microsoft made sure to provide you with a remarkable library named SignalR . The idea behind SignalR is let the server push changes automatically to connected clients instead of having each client polling the server on time intervals. And what does connected clients means anyway? The answer is hidden behind the concept of the HTTP persistent connections which are connections that may remain opened for a long time, in contrast with the tradional HTTP Connections that can be disconnected. The persistent connection remains opened due to certain type of packet exchanging between a client and the server. When a client calls a SignalR method on the server, the server is able to uniquely identify the connection ID of the caller.
  What this post is all about

   SignalR has been out for a long time but ASP.NET Core and Angular 2 aren’t. On this post we ‘ll see what takes to bind all those frameworks and libraries together and build a Real time application. This is not an Angular tutorial nor a SignalR one. Because of the fact that the final project associated to this post contains code that we have already seen on previous posts, I will only explain the parts that you actually need to know in order to build a real time application. And this is why I will strongly recomend you to download the Live-Game-Feed app and study the code along with me without typing it. Here’s what we ‘ll see in more detail..
  
       
  • Fire up an empty ASP.NET Core web application using yeoman   
  • Configure and install MVC and SignalR Server dependencies   
  • Install SignalR Client-Typescript dependencies   
  • Create a SignalR hub   
  • Integrate  MVC Controllers (API)  with SignalR   
  • Create the Angular-SignalR service to communicate with SignalR hubs   
  • Add Reccurent Tasks on a ASP.NET Core application   
  • Have fun with the final App!  
  About the LiveGameFeed app

   The app simulates a web application that users may visit and watch matches live. I am sure you are aware of plenty of such websites, most of them are related to betting. The idea is that there will be two matches running, and every time score is updated all connected clients will receive the update. On the other hand, if a user also wants to getting live feed for a specific match then he/she has to be subscibed to the match. More over, if subscribed, the user will be able to post messages related to that match while those messages will be pushed and read only by users also subscribed to the that match. Why don’t we take a look at the LiveGameFeed app (zoom out a little bit if needed so that you can see both clients) ..
   
Real-time applications using ASP.NET Core, SignalR & Angular-1 (experience,Facebook,Microsoft,connected,contrast)

  Are you ready? Let’s start!
  Fire up an empty ASP.NET Core web application using yeoman

   I assume you have already installed .NET Core on your platform and you have opened the Live-Game-Feed app on your favorite text editor. You can start a .NET Core application either using the dotnet-new cli command or using the open-source yeoman tool. I picked the latter choise cause there are some great options to fire up a ASP.NET Core application. In order to use yeoman you need to run the following commands.
  [code]npm install -g yo bower[/code]  [code]npm install -g generator-aspnet[/code]  Next, open a console and navigate where you want to fire up the project and run the following command:
  [code]yo aspnet[/code]  The tool will give you some options to start with.

Real-time applications using ASP.NET Core, SignalR & Angular-2 (experience,Facebook,Microsoft,connected,contrast)

   Select Empty Web Application and give a name for your app.
123下一页
友荐云推荐




上一篇:A Beginners Guide to JXA, JavaScript Application Scripting
下一篇:微网站:让你的网站在用户的手机里安家
酷辣虫提示酷辣虫禁止发表任何与中华人民共和国法律有抵触的内容!所有内容由用户发布,并不代表酷辣虫的观点,酷辣虫无法对用户发布内容真实性提供任何的保证,请自行验证并承担风险与后果。如您有版权、违规等问题,请通过"联系我们"或"违规举报"告知我们处理。

edi3son 发表于 2016-10-10 20:51:01
人生最痛苦的事就是方便面涨价了。
回复 支持 反对

使用道具 举报

借幸福给你 发表于 2016-11-8 06:00:33
发贴技术哪家强?Lonelypartn
回复 支持 反对

使用道具 举报

飞天是 发表于 2016-11-21 08:39:54
非常好,顶一下
回复 支持 反对

使用道具 举报

*滑动验证:
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

我要投稿

推荐阅读

扫码访问 @iTTTTT瑞翔 的微博
回页顶回复上一篇下一篇回列表手机版
手机版/CoLaBug.com ( 粤ICP备05003221号 | 文网文[2010]257号 )|网站地图 酷辣虫

© 2001-2016 Comsenz Inc. Design: Dean. DiscuzFans.

返回顶部 返回列表