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

  • SignalR Blueprints
  • Einar Ingebrigtsen
  • 288字
  • 2021-07-23 20:36:23

The goal – how to create a basic forum discussion site

Forums have been around since the dawn of computing, taking on many forms: bulletin board systems, user groups, and also web-based forums on different sites. In this chapter, we'll build our own forum and light it up with SignalR, improving the overall user experience and also scalability of the solution. We'll use the top-level abstraction within SignalR called a hub. The hub enables us to expose methods from the server directly to the client and also makes it possible to call functions on the client side from the server directly.

By the end of the chapter, you'll understand the basics of SignalR and how to use the top-level abstraction: hub. Also, you will briefly look at what MVC gives you in combination with Entity Framework.

So, let's just jump straight into it!

Hub

At the core level of SignalR sits something called a PersistentConnection class; hubs build on top of this. We won't be covering PersistentConnection as it is far more convenient to be working with the hub. In my opinion, a hub is the preferred abstraction to use; most applications really don't need to go any lower than this. It provides functionality to define functionality on the server in a C# class, much like an MVC or a Web API controller with the exception of it being persistently connected, leaving it possible to also call functionality on the client as well. The clients consume the hub and can directly call the methods on them. However, these clients can also register the client functions it responds to and create a subscription from the client that makes it respond to what it registered when the server calls it.

主站蜘蛛池模板: 综艺| 子洲县| 澄城县| 静乐县| 黑水县| 静宁县| 乡宁县| 唐河县| 漳浦县| 冕宁县| 平邑县| 扎囊县| 杭锦后旗| 锡林郭勒盟| 北碚区| 叙永县| 永仁县| 高雄市| 巴楚县| 罗源县| 巴彦县| 桐柏县| 通化县| 徐汇区| 东乌| 祁东县| 南召县| 聂荣县| 衢州市| 剑川县| 文水县| 白城市| 安乡县| 连山| 呈贡县| 安丘市| 渝中区| 朝阳区| 财经| 宁武县| 临洮县|