ASP.NET SignalR is a library for ASP.NET developers that simplifies the process of adding real-time web functionality to applications.
SignalR provides a simple API for creating server-to-client remote procedure calls (RPC) that call JavaScript functions in client browsers (and other client platforms) from server-side .NET code. SignalR also includes API for connection management (for instance, connect and disconnect events), and grouping connections.
SignalR applications can scale out to thousands of clients using built-in, and third-party scale-out providers.
- Service Bus
- SQL Server
- Redis
- NCache
SignalR uses the new WebSocket transport where available and falls back to older transports where necessary.
- WebSocket (the optimal transport for SignalR)
- Server Sent Events (aka EventSource )
- Forever Frame (for Internet Explorer only)
- Ajax long polling
You can determine what transport your application is using by enabling logging on your hub, and opening the console window in your browser. To enable logging for your hub's events in a browser, add the following command to your client application:
$.connection.hub.logging = true;
The SignalR API contains two models for communicating between clients and servers:
- Persistent Connections. A Connection represents a simple endpoint for sending single-recipient, grouped, or broadcast messages.
- Hubs. A Hub is a more high-level pipeline built upon the Connection API that allows your client and server to call methods on each other directly.
When server-side code calls a method on the client, a packet is sent across the active transport that contains the name and parameters of the method to be called (when an object is sent as a method parameter, it is serialized using JSON). The client then matches the method name to methods defined in client-side code. If there is a match, the client method will be executed using the deserialized parameter data.