Original text: Step by step learning signalr for real-time communication _1_ Brief introduction
Step-by-step learning signalr for real-time communication \_1_ Brief introduction
SignalR
- Step-by-step learning signalr for real-time communication _1_ Brief introduction
- Objective
- SIGNALR Introduction
- Supported platforms
- Related instructions
- Conclusion
- Reference documents
Objective
Originally a few months ago want to write a series of articles about SIGNALR, but because in the project, time is very urgent, took 1 days to roughly understand the next signalr, and realized a small online chat function, originally recorded a series of articles about SIGNALR, Did not expect to write MVC5 use SIGNALR for two-way communication (1) After the stop, now a little free point, take some time to complete learning signalr. In the garden There are also many articles about SIGNALR, such a simple introduction of the next signalr, and realize a real-time chat function, but in fact signalr there are many things we can dig into, I hope to record my detailed study process.
SIGNALR Introduction
SIGNALR is a framework that can help us build a real-time interactive, multi-user application. One of the great advantages of this is that it is transparent to the developer, and it will decide for itself the best use of that technology (long polling, persistence framework, websockets, etc.) and automatically manage connections and disconnects. For more information, see the garden in another article.
SIGNALR provides us with 2 different levels of abstraction, respectively persistent connections
, andHubs
It's not my style, I'm more focused on what a technology can do, and I'll simply mention here that there are 2 things that will help signalr follow-up.
Supported platforms
In this article is very detailed, there is no need to repeat an article
Related instructions
We are using SIGNAL2, which may be different from the first version and not discussed here.
OWIN
Here we are all based on owin to be realized. Owin is roughly the following structure:
Implements the structure of the SIGNALR:
Associated assemblies after installation of SIGNALR
1. Owin structure
Comparison should be very well understood, Owin implements a common interface, and SIGNALR is based on this interface requirements set up a framework, similar to WEBAPI.
Having seen these two pictures, the concept of owin should be well understood.
As can be seen from the first picture, Owin is mainly composed of five parts: Host、Server、Middleware、Web framework以及Application
.
2. Detailed Introduction
Looking at the second picture and the third picture, the third picture is that after the installation is complete SIGNALR, these 6 packages are related to SIGNALR and Owin
- Host: Where the request is executed, generally on IIS, it can be built on its own console application, the specific method is described here.
- Server: That
Microsoft.Owin.Host.SystemWeb
is Microsoft.Owin.HttpListener
, it is the function of opening a port to communicate with the client.
- Middleware: That is Misrosoft.AspNet.SignalR.XXX this is the SignalR that we installed, if the WEBAPI installed, it may be Misrosoft.AspNet.WebApi.XXX, He is a series of frameworks that have achieved owin.
- Web framework: such as the SIGNALR or Web API we are now introducing.
- Application: For our project, it can be MVC, Web Form, or WPF.
My understanding is that SIGNALR has a core service called Microsoft.AspNet.SignalR.Core
, which implements the Owin interface through a similar adapter concept to Microsoft.AspNet.SignalR.SystemWeb
work together.
Conclusion
This chapter for the general introduction of SIGNALR here, originally did not want to write the concept of things, after all, I am a focus on the realization of the people, learning there are 2 ways one is in the language, the other is to achieve in-depth, before I may be the second form, but for programmers, superficial understanding is also a good way, After all, it's very difficult to get in touch with something new and go straight into it.
There's no big problem with what you don't understand in this chapter, and you'll step through the code to implement some of the functionality later.
This article publishes to the job tribe
Reference documents
ASP-SIGNALR Series
SignalR programming in Microsoft asp PDF download
Step-by-step learning signalr for real-time communication _1_ Brief introduction