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

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.

主站蜘蛛池模板: 绥芬河市| 黄平县| 临泽县| 甘德县| 雅江县| 盐亭县| 竹北市| 东城区| 博乐市| 宁城县| 满洲里市| 鹤峰县| 永新县| 蒙城县| 大方县| 宝应县| 河东区| 汉源县| 十堰市| 关岭| 汉阴县| 阜新市| 随州市| 综艺| 刚察县| 兴国县| 香格里拉县| 亳州市| 随州市| 龙岩市| 石狮市| 张家川| 炉霍县| 玉山县| 成安县| 灌云县| 凌云县| 浦北县| 南平市| 九龙坡区| 富阳市|