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

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.

主站蜘蛛池模板: 绥芬河市| 宿松县| 金堂县| 襄垣县| 宁都县| 连城县| 武城县| 册亨县| 桦川县| 清涧县| 罗甸县| 鄱阳县| 淮安市| 玛多县| 昭通市| 通化县| 南部县| 潜山县| 大城县| 屯昌县| 尼木县| 漠河县| 灌阳县| 临潭县| 蛟河市| 潜山县| 卢湾区| 淳安县| 醴陵市| 克拉玛依市| 新竹县| 新源县| 体育| 滦平县| 马尔康县| 通海县| 扶沟县| 泰来县| 德清县| 萨嘎县| 乐昌市|