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

Introduction

SignalR is an amazing framework that delivers a real-time and bidirectional messaging platform. SignalR provides several options to reach its goal, but in this chapter we'll start simple and use the most basic API to set up a persistent and real-time channel: Hubs. A Hub is a special class that SignalR will expose to all the connected clients, allowing them to make Remote Procedure Calls (RPC) to it. Inside the Hub, the developer will also have a set of special objects to use in order to perform calls back onto the connected clients.

There is a very important detail to highlight: SignalR is composed of a server-side library and a set of client-side libraries. In every working solution, you will always need to use both; you will need to expose the server-side endpoints and connect to them using the most appropriate client library. SignalR will do the rest, and you will experience a very natural, simple, and bidirectional programming model.

All the recipes in this chapter will be classic "Hello World" applications. Nothing fancy or exciting will be happening, but all of them will clearly illustrate what can be achieved and how. The Adding a Hub to an ASP.NET project and Adding a Hub to a self-hosting application recipes will show you how to prepare a server portion of a SignalR application using the Hub type in different hosting contexts, whereas the Connecting to a Hub from a JavaScript client and Connecting to a Hub from a .NET application recipes will illustrate how to write client-side code to connect to it from different types of client processes. Each recipe has the goal to be fully functional, therefore all of them will in some way provide at least some hints about the missing counterparts. Server-side recipes will have minimal client code in place, and client-side ones will either contain a basic Hub to connect to or refer to one created earlier, but for all of them, the focus will remain on the actual topic of the recipe.

主站蜘蛛池模板: 绵阳市| 阿鲁科尔沁旗| 丹棱县| 长沙县| 永德县| 丹凤县| 保山市| 青田县| 峡江县| 平乐县| 远安县| 涿鹿县| 平乡县| 北川| 罗平县| 宣汉县| 汨罗市| 辰溪县| 河南省| 肃北| 达尔| 瓦房店市| 航空| 威远县| 巢湖市| 泾源县| 黄龙县| 北碚区| 玉门市| 囊谦县| 承德县| 银川市| 容城县| 阳东县| 扎囊县| 准格尔旗| 雅安市| 宿州市| 金华市| 通许县| 全州县|