Real time fluent communication using SignalR and Cloud (Windows Azure)

43
Microsoft Summit 2013 the ultimate business and technology conference Architecture & Best Practices Track

Transcript of Real time fluent communication using SignalR and Cloud (Windows Azure)

Page 1: Real time fluent communication using SignalR and Cloud (Windows Azure)

Microsoft Summit 2013the ultimate business and

technology conferenceArchitecture & Best

Practices Track

Page 2: Real time fluent communication using SignalR and Cloud (Windows Azure)

Real-time fluent communication using SignalR and CloudRadu VunvuleaiQuest Group

Page 3: Real time fluent communication using SignalR and Cloud (Windows Azure)

Scope

What?Why?

When?Where?

How?

Page 4: Real time fluent communication using SignalR and Cloud (Windows Azure)

Agenda• Internet in our days• Fluent communication• Connection methods• Security• Performance• Scalability• Conclusion

Page 5: Real time fluent communication using SignalR and Cloud (Windows Azure)

{“name” : “Radu Vunvulea,“company” : “iQuest Group”,“userType” : “enthusiastic”“technologies” : [“Azure”, “.NET”, “JS”, “Web”, “Mobile”, “WPF”, “SL” ],“expertise” : [“enterprise”, “pharma”, “automotive”, “home automation”, “e-Commerce” ],“blog” : “vunvulearadu.blogspot.com”,“email” : ”[email protected]”,“socialMedia” :

{“twitter” :

“@RaduVunvulea”,“fb” : “radu.vunvulea”

}

}

Who am I?

Page 6: Real time fluent communication using SignalR and Cloud (Windows Azure)

Internet in our days

Page 7: Real time fluent communication using SignalR and Cloud (Windows Azure)
Page 8: Real time fluent communication using SignalR and Cloud (Windows Azure)

Internet during the time• Real Time Web• Real Time Libraries & Web

SocketFuture

• Ajax• jQuery & Prototype

Present

• Static Web• HTML & Request/ResponsePast

Page 9: Real time fluent communication using SignalR and Cloud (Windows Azure)
Page 10: Real time fluent communication using SignalR and Cloud (Windows Azure)

Fluent communication

Page 11: Real time fluent communication using SignalR and Cloud (Windows Azure)

Real Time InteractionChatNotificationsWeatherStock marketCommerce

AuctionGamesMonitoringDashboardDocument editing

Page 12: Real time fluent communication using SignalR and Cloud (Windows Azure)

Current solutions

WebSocketForever FrameServer Send EventsPoolingSPDY

Page 13: Real time fluent communication using SignalR and Cloud (Windows Azure)

Available FrameworksCommetPusherSockJSSocketIOFaye

Now.jsSseDjango-sseCrampOpenPush

Page 14: Real time fluent communication using SignalR and Cloud (Windows Azure)

Available FrameworksCommetPusherSockJSSocketIOFaye

Now.jsSseDjango-sseCrampOpenPush

SignalR

Page 15: Real time fluent communication using SignalR and Cloud (Windows Azure)

What is SignalR• Async library for .NET to help build real-

time, multiuser interactive web applications

• Bidirectional communication• Adopted by Microsoft• Open Source• GitHub

Page 16: Real time fluent communication using SignalR and Cloud (Windows Azure)

Supported PlatformsServer• Windows (.NET)• Linux (Mono)Clients• IE, Chrome, Firefox, Safari, Opera, Android

Brower • IoS, Windows Desktop, Silverlight,

Windows Store, Windows Phone …

Page 17: Real time fluent communication using SignalR and Cloud (Windows Azure)

Connection Methods

Page 18: Real time fluent communication using SignalR and Cloud (Windows Azure)

Connection Methods

WebSocket

Server Side Events

Forever Frame

Ajax long pooling

Page 19: Real time fluent communication using SignalR and Cloud (Windows Azure)

Persistent ConnectionSimilar with WebSocket• Persistent• Events• Connect• Disconnect• Receive• Error

Methods• Send• Broadcast

Page 20: Real time fluent communication using SignalR and Cloud (Windows Azure)

HubsOver Persistent ConnectionsShare variablesCalls between client and serverSerialization

Capture connect/disconnect Everything works by magic

Page 21: Real time fluent communication using SignalR and Cloud (Windows Azure)

HubsWhen you have multiple hubs• Same connection is

shared by a client• Groups are

maintained separately for each hub

• One proxy JS file for all hubs

Async support• OnConnected• OnDisconnected• OnReconnected• proxy.State (JS)• Client.Caller (C#)

Page 22: Real time fluent communication using SignalR and Cloud (Windows Azure)
Page 23: Real time fluent communication using SignalR and Cloud (Windows Azure)

Demo

Page 24: Real time fluent communication using SignalR and Cloud (Windows Azure)

Hubs vs Persistent ConnectionsHubs• Remote invocation• Easy to use and

manage• Best for simple use

cases

Persistent Connections• Message format

needs to be specified

• Messaging and dispatching model

• An existing app is ported to SignalR

Page 25: Real time fluent communication using SignalR and Cloud (Windows Azure)

Security

Page 26: Real time fluent communication using SignalR and Cloud (Windows Azure)

SecurityConnection Token • Connection

Id+Username• Unique• Managed by server• Encrypted with a digital

signature

Page 27: Real time fluent communication using SignalR and Cloud (Windows Azure)

SecurityConnection Id • Exists until the end of

connectionUsername• Only for authenticated

users• Passed between client

and server for each request

Page 28: Real time fluent communication using SignalR and Cloud (Windows Azure)
Page 29: Real time fluent communication using SignalR and Cloud (Windows Azure)
Page 30: Real time fluent communication using SignalR and Cloud (Windows Azure)

CSRF

Disable cross domain requests

Verify connection token

Put connection token in query string

The connection token is not persisted on the client

Page 31: Real time fluent communication using SignalR and Cloud (Windows Azure)

Performance

Page 32: Real time fluent communication using SignalR and Cloud (Windows Azure)

PerformanceSingle Box• Over 450.000 messages

per second• 15.000 – 20.000

connections (hardware limitations – ports)

Page 33: Real time fluent communication using SignalR and Cloud (Windows Azure)

PerformanceWeb farm• You have “NO” limit • You need to synchronize

each node from the farm

Page 34: Real time fluent communication using SignalR and Cloud (Windows Azure)
Page 35: Real time fluent communication using SignalR and Cloud (Windows Azure)

Solution

Page 36: Real time fluent communication using SignalR and Cloud (Windows Azure)

SignalR FarmBackplanes:• Windows Azure Service

Bus• Redis• SQLServer

Server broadcast High-frequency realtime Client to client

Server Server

Backplane

Page 37: Real time fluent communication using SignalR and Cloud (Windows Azure)

Demo

Page 38: Real time fluent communication using SignalR and Cloud (Windows Azure)

Conclusion

Page 39: Real time fluent communication using SignalR and Cloud (Windows Azure)

ConclusionSignalR is great for:• Client to Server communication• Server to Client communication• Broadcasting• Real Time Applications• Scalable Solutions• Low latency

Page 40: Real time fluent communication using SignalR and Cloud (Windows Azure)

Question

Answers

Page 41: Real time fluent communication using SignalR and Cloud (Windows Azure)

Thank you{

“name” : “Radu Vunvulea, “blog” : “vunvulearadu.blogspot.com”, “email” : ”[email protected]”,“socialMedia” :

{“twitter” :

“@RaduVunvulea”,“fb” : “radu.vunvulea”

}}

Page 42: Real time fluent communication using SignalR and Cloud (Windows Azure)
Page 43: Real time fluent communication using SignalR and Cloud (Windows Azure)