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

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.

主站蜘蛛池模板: 彰化市| 治县。| 满洲里市| 广宁县| 闽清县| 本溪| 罗甸县| 宁国市| 阿瓦提县| 深水埗区| 湖南省| 称多县| 通江县| 阜平县| 赤壁市| 武功县| 莫力| 运城市| 仙游县| 云霄县| 方城县| 林芝县| 阿拉尔市| 庆城县| 专栏| 上杭县| 濉溪县| 新乐市| 衡水市| 巴东县| 淳安县| 平和县| 江山市| 集安市| 秦安县| 措美县| 周口市| 庐江县| 鹰潭市| 固原市| 北碚区|