real-time communications with signalr

23
Real-time Communications with SignalR Shravan Kumar Kasagoni

Upload: shravan-kumar-kasagoni

Post on 21-Jul-2015

88 views

Category:

Technology


4 download

TRANSCRIPT

Real-time Communications with SignalR

Shravan Kumar Kasagoni

Agenda

1) Introduction to the real-time web

2) ASP.NET SignalR

3) Building a real-time

Real-time Application?

Real-time 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.

Without real-time

With real-time

Why Real-time?

Users want the latest info, NOW!

Show Me Some Examples

Twitter, Facebook, Mail - live searches/updates Stock streamers Auctions Interactive games Live Scores Collaborative apps (google docs, office web

apps) Live user analytics (live graphs)

How to build real-time web apps?

HTTP is an old beast…

Never designed for real-time communications

Web is all about request-response Web is stateless

How to do real-time in web?

Periodic polling

Poll from time to time using Ajax Delay in communication due to polling interval Wastes bandwidth & latency

Server

ClientPolling interval

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

Server

Client

Forever Frame

Server tells client that response is chucked Client keeps connection open until server closes it Server pushed data to the client followed by \0 Consumes server threads

Server

Client

HTML5 Web sockets

Extension to HTTP Provides raw sockets over HTTP Full-duplex Traverses proxies

It's still a working draft Not every proxy server supports it Not every web server supports it Not every browser supports it They are raw sockets!

too many options

Basically…

Introducing SignalR

• Abstraction over transports

• Events instead of task/async

• Connection management

• Broadcast or target specific client

What does SignalR do?

• Client to Server persistent connection over HTTP

• Easily build multi-user, real-time web applications

• Auto-negotiates transport

SignalR Fallback

Long

Polling

Forever

Frames

Server

Sent

Events

Web

Sockets

What does SignalR do?

• Allows server-to-client push and RPC

• Built async to scale to 1000’s of connections

• Scale out with Service Bus, SQL Server & Redis

• Open Source on GitHub

Backplane

SignalR Backplanes

Load balancing via a common transport mechanism

Thank You