2. SUMMARY
• DEFINING PROBLEM SPACE
• EXISTING TECHNOLOGIES
• INTRODUCTION TO SIGNALR
• ARCHITECTURE AND COMPONENTS
• DEMO/EXAMPLES
3. THE PROBLEM: CLIENT WANT FRESH
DATA
• You (the «customer») want latest info (data)!
• You need them NOW!
• RealTime!
Examples of apps :
• Twitter / Facebook / many more…
• Notifications.
• Auctions / Stock trading / Banking.
• Live user analitics
• Search/update
• Collaborative apps(Google docs,
• Interactive games
4. REALTIME APPLICATIONS, DEVELOPERVIEW
• Persistent Connections between endpoints.
• Two way communication (full-duplex).
• Low Latency ( :D ).
• Low overhead.
• Over the «wire» (intranet/internet/generic communication medium).
6. PERIODIC POLLING
Poll from time to time using Ajax
Delay in communication due to polling interval
Wastes bandwidth & latency & resources
Server
Client
Polling interval
7. LONG POLLING
Poll but doesn’t respond until there's data
Poll again after data received or after the connection times out
Consumes server & threads & connection resources
Better than the previous one: less requests.
Server
Client
8. FOREVER FRAME
Server
Client
This technique is very low-latency because it avoids HTTP and
TCP/IP set-up and tear-down by reusing a single long-lived
connection. It uses "chunked encoding", a feature of HTTP/1.1
intended for an entirely different purpose, but which allows the
server to maintain a connection to the client indefinitely, sending
additional data to the client at will.
9. IFRAME ("Forever frame"): Loading a page in an IFRAME that incrementally receives
commands wrapped in <script> tags, which the browser evaluates as they are
received.
• Data is sent out in chunks.
• Add an IFrame to the page (its content length is declared to be
indefinitely long).
• Load in the IFrame a page with a script in it (execute it to get your
chunk of data).
• The next chunk of data arrives in the form of another script that is
executed again.
• The cycle goes on and on and on...
It causes pollution in the long run…all those script tags stays there even if you don’t
need them anymore.
FOREVER FRAME IEWAY
10. Server-Sent Events (SSE) are a standard describing how servers can
initiate data transmission towards clients once an initial client
connection has been established. They are commonly used to send
message updates or continuous data streams to a browser client and
designed to enhance native, cross-browser streaming through a
JavaScript API called EventSource, through which a client requests a
particular URL in order to receive an event stream.
Server-Sent Events (SSE)
11. HOWTO BUILD REAL-TIMEWEB APPS?
Never designed for real-time communications
Web is all about request-response
Web is stateless
12. INTRODUCTING SIGNALR HISTORY
• Signal R was created as an open source project by two
Microsoft employees: David Fowler & Damien Edwards
• Adopted by Microsoft, but remains open source on
GitHub
• Like jQuery for communication
• Distributed via NuGet
13. INTRODUCTING SIGNALR
• SignalR is a series of abstractions around a few persistent HTTP
techniques(library).
• Persistent Connection Abstraction communication library.
• Abstracts protocol and transfer (choses the best one).
• A single programming model (a unified development experience).
• Extremely simple to use.
• Server-side it can be hosted in different «environments» (ASP.NET,
console apps, windows services, etc…).
• Client-side there’s support for: Javascript clients, .NET clients, WP;
provide by the community: iOS, Android.
19. CONCEPTUAL IMPLEMENTATION OF
HUBS
The use of hubs is recommended when we need to send different types of
messages with various structures between the client and the server.
20. CONCLUSIONS
• SignalR is a server-side software system designed for writing
scalable Internet applications, notably web servers. Programs are
written on the server side in C#, using event-driven, asynchronous
I/O to minimize overhead and maximize scalability.
• SignalR takes advantage of several transports, automatically
selecting the best available transport given the client's and server's
best available transport.
21. RESOURCES
Microsoft ASP.NET SignalR: The Real-Time Web Made Simple
http://channel9.msdn.com/Events/TechEd/NorthAmerica/2013/DEV-B302
Building Real-time Web Apps with ASP.NET SignalR
http://channel9.msdn.com/Events/Build/2012/3-034
Introducing ASP.NET SignalR - Push Services with Hubs
http://pluralsight.com/training/courses/TableOfContents?courseName=signalr-
introduction
github.com/SignalR/SignalR
https://html.spec.whatwg.org/multipage/comms.html