4. Presenter: Richi Padhi, Mindfire Solutions
Introduction
What is SignalR?
ASP.NET SignalR is a library for ASP.NET developers that simplifies the process of
adding real-time web functionality to applications.
Library to maintain asynchronous (non blocking threads) over persistent connection
in ASP.NET applications.
What is "real-time web" functionality?
Real-time web functionality is the ability to have server code push content to
connected clients instantly as it becomes available, rather than having the server
wait for a client to request new data.
Example : Chat, Email, Stock Ticker, Game Live Score, Real-Time Gaming, Document
Collaboration
5. Presenter: Richi Padhi, Mindfire Solutions
Introduction
>> 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 also it handles
connection management automatically.
>> It can reach out to thousands of clients using Service Bus, SQL Server or
Redis.
>> Abstracts away the network layer for bidirectional real-time
communications, thus helping developers focus on building application.
7. Presenter: Richi Padhi, Mindfire Solutions
How SignalR Works?
>> SignalR allows bidirectional communication between client & server over
persistant connections
>> It provides simple APIs for RPC
>> SignalR chooses the best fit transport mechanisms for the given client and
server environment.
>> Manages and gives fine grained control over network layer and also has
an auto fallback mechanism.
9. Presenter: Richi Padhi, Mindfire Solutions
How SignalR Works?
Order of network transports
HTML 5 Transports :
>> WebSockets
>> Server Sent Events
Comet Transports (long-held HTTP request) :
>> Forever Frame
>> Ajax Long Polling
10. Presenter: Richi Padhi, Mindfire Solutions
How SignalR Works?
WebSockets
>> A new HTML5 API that enables bi-directional, full duplex communication
between the browser and server.
>> It is the new standard defined as a part of HTML 5 to solve two major problems
of current web:
Overhead of HTTP (Network Throughput)
Low Latency
>> Standardized
11. Presenter: Richi Padhi, Mindfire Solutions
How SignalR Works?
Server Sent Event
>> A technology where a browser receives automatic updates from a server via
HTTP connection. The Server-Sent Events EventSource API is standardized as part
of HTML5
>> This was also possible before, but the web page would have to ask if any
updates were available. With server-sent events, the updates come automatically.
>> Supported in all major browsers, except Internet Explorer.
12. Presenter: Richi Padhi, Mindfire Solutions
How SignalR Works?
Forever Frame
>> Forever Frame creates a hidden IFrame which makes a request to an endpoint
on the server that does not complete. The server then continually sends script to
the client which is immediately executed, providing a one-way realtime connection
from server to client.
>> The connection from client to server uses a separate connection from the
server to client connection, and like a standard HTML request, a new connection is
created for each piece of data that needs to be sent.
13. Presenter: Richi Padhi, Mindfire Solutions
How SignalR Works?
Ajax Long Polling
>> Long polling does not create a persistent connection, but instead polls the
server with a request that stays open until the server responds, at which point the
connection closes, and a new connection is requested immediately.
>> This may introduce some latency while the connection resets.
16. Presenter: Richi Padhi, Mindfire Solutions
SignalR API & Architecture
The SignalR API contains two models for communicating between clients and
servers: Persistent Connections & Hubs
Connection
A Connection represents a simple endpoint for sending single-recipient, grouped,
or broadcast messages.
Persistent Connections
>> Low level access to communication
>> Direct developer access to network pipeline
>> Access to lot more communication events
>> Will be familiar to developers who have used connection-based APIs such as
WCF
17. Presenter: Richi Padhi, Mindfire Solutions
SignalR API & Architecture
Hubs
>> High level abstraction
>> Built on top of Persistent Connections
>> Least developer work
>> Works for majority of user
>> Will be familiar to developers who have used remote invocation APIs such as
.Net Remoting.