I. Overview
The ASP. NET SIGNALR is a new library for ASP, which makes it easier and more convenient to develop real-time communication functions.
SIGNALR allows two-way communication between the client and the server. The server can push content to the connected client.
SIGNALR supports web Sockets and encounters other older browsers signalr will support "two-way communication" (don't be serious) with other technologies.
SIGNALR includes these APIs: connection management (for example, connected and disconnected events), grouping of connections, and authorization of access capabilities.
Second, cognition with talk
SIGNALR can be used to add any form of "real-time communication" functionality to your ASP. chatting is often used as an example of an application, and of course you can do more things.
Users often refresh the page to see new data, or the page supports long polling to retrieve new data, which is supported in the SIGNALR mechanism, but it is smarter and more powerful and friendly.
SIGNALR also supports new types of network applications: the need for high-frequency updates from the server (such as live games, see this SHOOTR game.)
SIGNALR provides a more convenient and simple API,
1. These APIs can be used to create remote calls between the server and the client.
The server-side code can invoke JavaScript functions on the browser {including other platforms};
Of course, the client also has a way to invoke the server (this is well understood)
2. These APIs can: connection management (for example, connecting and disconnecting events), grouping of connections, and authorization of access functions.
These two graphs describe the mutual invocation between the client and the server
Third, further understanding
SIGNALR can automate the processing of connection management, which allows you to broadcast messages to all connected clients at a point in time,
It's like a chat room. You can also send the message to a specific customer. The connection between the client and the server is persistent, unlike the classic HTTP connection that requires re-establishing the communication.
SIGNALR supports the "Server Push" feature, as mentioned, can make RPC calls to clients, different from the familiar answer mode
SIGNALR is open source and can get the source code through GITHUB.
Iv. the relationship between SIGNALR and WebSocket
SIGNALR automatically uses WebSocket communication (as long as conditions permit), and other old transports are automatically used when the condition is not met. Of course you can directly get your program to use WebSocket directly.
Using SIGNALR means that the work you need to spend your energy on does not need to be done yourself, because it has been done for you. Most importantly, it will keep up to date with WebSocket technology, so you don't have to worry
The agreement changes such things.
SIGNALR is an abstraction of how clients and servers communicate with each other. An SIGNALR is started with an HTTP connection, and then is directly promoted to the WebSocket connection when the environment allows it.
WebSocket is the ideal means of communication for SIGNALR because WebSocket makes the most efficient use of the server's memory while WebSocket has the lowest latency and has the most underlying characteristics, such as full-duplex communication between the client and the server. But WebSocket also has the most stringent requirements: WebSocket requires the server to use Windows Server 2012 or Windows 8, and. NET Framework 4.5. If these requirements are not met, SIGNALR will attempt to connect using other means of communication.
Five, the use of built-in technology steps
The following list shows how SIGNALR decides which communication method to use
- If the browser <=internet Explorer 8, use the long polling method
- If using JSONP is specified in the configuration, a long polling method is used
- How to create a cross-domain connection, such as using WebSocket, if the condition is met (otherwise with long polling)
- Client Support WebSocket
- Service-Side Support WebSocket
- Client Support Cross-origin Resource sharing, this everybody own Baidu
Brother Taiwan, in order to enhance my writing courage, to support the recommendation and collection AH.