signalr on old-school servers & clients when some lower-common denominator polling mechanism is...
TRANSCRIPT
![Page 1: SignalR on Old-school Servers & Clients When some lower-common denominator polling mechanism is needed Web Server HTML Client Got Data? Here’s some](https://reader030.vdocument.in/reader030/viewer/2022032705/56649d825503460f94a6806a/html5/thumbnails/1.jpg)
![Page 2: SignalR on Old-school Servers & Clients When some lower-common denominator polling mechanism is needed Web Server HTML Client Got Data? Here’s some](https://reader030.vdocument.in/reader030/viewer/2022032705/56649d825503460f94a6806a/html5/thumbnails/2.jpg)
Building Real-Time Applications with ASP.NET SignalR
Brady Gaster
DEV-B343
![Page 3: SignalR on Old-school Servers & Clients When some lower-common denominator polling mechanism is needed Web Server HTML Client Got Data? Here’s some](https://reader030.vdocument.in/reader030/viewer/2022032705/56649d825503460f94a6806a/html5/thumbnails/3.jpg)
![Page 4: SignalR on Old-school Servers & Clients When some lower-common denominator polling mechanism is needed Web Server HTML Client Got Data? Here’s some](https://reader030.vdocument.in/reader030/viewer/2022032705/56649d825503460f94a6806a/html5/thumbnails/4.jpg)
SignalR is an abstraction that intelligently decides how to enable real-time over HTTP
![Page 5: SignalR on Old-school Servers & Clients When some lower-common denominator polling mechanism is needed Web Server HTML Client Got Data? Here’s some](https://reader030.vdocument.in/reader030/viewer/2022032705/56649d825503460f94a6806a/html5/thumbnails/5.jpg)
SignalR on Old-school Servers & ClientsWhen some lower-common denominator polling mechanism is needed
Web
Serv
er H
TM
L C
lien
t
Got Data?
Got Data?
Got Data?
Got Data?
Got Data?
Got Data?
Got Data?
Got Data?
Here’s some data
![Page 6: SignalR on Old-school Servers & Clients When some lower-common denominator polling mechanism is needed Web Server HTML Client Got Data? Here’s some](https://reader030.vdocument.in/reader030/viewer/2022032705/56649d825503460f94a6806a/html5/thumbnails/6.jpg)
SignalR on Modern Servers & ClientsWhen WebSockets or some other real-time layer is supported
Web
Serv
er H
TM
L C
lien
tI can party in real time. Can you?
Yep, I can party in real time
Let’s party in real time!
![Page 7: SignalR on Old-school Servers & Clients When some lower-common denominator polling mechanism is needed Web Server HTML Client Got Data? Here’s some](https://reader030.vdocument.in/reader030/viewer/2022032705/56649d825503460f94a6806a/html5/thumbnails/7.jpg)
SignalR Core Concepts
Hub
• A more high-level pipeline built upon the Connection API that allows your client and server to call methods on each other directly
Connection
• Represents a simple endpoint for sending single-recipient, grouped, or broadcast messages
Backplane
• A backplane allows you to scale your application to multiple servers. With a backplane enabled, each application instance sends messages to the backplane, and the backplane forwards them to the other application instances.
![Page 8: SignalR on Old-school Servers & Clients When some lower-common denominator polling mechanism is needed Web Server HTML Client Got Data? Here’s some](https://reader030.vdocument.in/reader030/viewer/2022032705/56649d825503460f94a6806a/html5/thumbnails/8.jpg)
Hubs
![Page 9: SignalR on Old-school Servers & Clients When some lower-common denominator polling mechanism is needed Web Server HTML Client Got Data? Here’s some](https://reader030.vdocument.in/reader030/viewer/2022032705/56649d825503460f94a6806a/html5/thumbnails/9.jpg)
A real-time hit counter
Demo
![Page 10: SignalR on Old-school Servers & Clients When some lower-common denominator polling mechanism is needed Web Server HTML Client Got Data? Here’s some](https://reader030.vdocument.in/reader030/viewer/2022032705/56649d825503460f94a6806a/html5/thumbnails/10.jpg)
Any sufficiently advanced technology is indistinguishable from magic - Arthur C. Clarke
![Page 11: SignalR on Old-school Servers & Clients When some lower-common denominator polling mechanism is needed Web Server HTML Client Got Data? Here’s some](https://reader030.vdocument.in/reader030/viewer/2022032705/56649d825503460f94a6806a/html5/thumbnails/11.jpg)
SignalR Hubs
A hub is a .NET class that inherits fromMicrosoft.AspNet.SignalR.Hub
Since Hubs are called on the client by name, the name can be customized if needed
The Clients property of a Hub class exposes dynamic properties useful for targeting specific clientsHub classes also have virtual methods useful for responding to connected/disconnected events
![Page 12: SignalR on Old-school Servers & Clients When some lower-common denominator polling mechanism is needed Web Server HTML Client Got Data? Here’s some](https://reader030.vdocument.in/reader030/viewer/2022032705/56649d825503460f94a6806a/html5/thumbnails/12.jpg)
Sending messages to all connected clients
Jon
Scott
BradyHub
Clients.All.doWork()
![Page 13: SignalR on Old-school Servers & Clients When some lower-common denominator polling mechanism is needed Web Server HTML Client Got Data? Here’s some](https://reader030.vdocument.in/reader030/viewer/2022032705/56649d825503460f94a6806a/html5/thumbnails/13.jpg)
Sending messages to the calling client
Jon
Scott
BradyHub
Clients.Caller.doWork()
![Page 14: SignalR on Old-school Servers & Clients When some lower-common denominator polling mechanism is needed Web Server HTML Client Got Data? Here’s some](https://reader030.vdocument.in/reader030/viewer/2022032705/56649d825503460f94a6806a/html5/thumbnails/14.jpg)
Sending messages to other connected clients
Jon
Scott
BradyHub
Clients.Others.doWork()
![Page 15: SignalR on Old-school Servers & Clients When some lower-common denominator polling mechanism is needed Web Server HTML Client Got Data? Here’s some](https://reader030.vdocument.in/reader030/viewer/2022032705/56649d825503460f94a6806a/html5/thumbnails/15.jpg)
Sending messages to specific users
Jon
Scott
BradyHub
Clients.Users(“Brady”).doWork()
![Page 16: SignalR on Old-school Servers & Clients When some lower-common denominator polling mechanism is needed Web Server HTML Client Got Data? Here’s some](https://reader030.vdocument.in/reader030/viewer/2022032705/56649d825503460f94a6806a/html5/thumbnails/16.jpg)
Real-time Web
![Page 17: SignalR on Old-school Servers & Clients When some lower-common denominator polling mechanism is needed Web Server HTML Client Got Data? Here’s some](https://reader030.vdocument.in/reader030/viewer/2022032705/56649d825503460f94a6806a/html5/thumbnails/17.jpg)
SignalR with Angular
Demo
![Page 18: SignalR on Old-school Servers & Clients When some lower-common denominator polling mechanism is needed Web Server HTML Client Got Data? Here’s some](https://reader030.vdocument.in/reader030/viewer/2022032705/56649d825503460f94a6806a/html5/thumbnails/18.jpg)
Damian’s MoveShape DemoDemo
![Page 19: SignalR on Old-school Servers & Clients When some lower-common denominator polling mechanism is needed Web Server HTML Client Got Data? Here’s some](https://reader030.vdocument.in/reader030/viewer/2022032705/56649d825503460f94a6806a/html5/thumbnails/19.jpg)
My MoveShape Demo
Demo
![Page 20: SignalR on Old-school Servers & Clients When some lower-common denominator polling mechanism is needed Web Server HTML Client Got Data? Here’s some](https://reader030.vdocument.in/reader030/viewer/2022032705/56649d825503460f94a6806a/html5/thumbnails/20.jpg)
Authorization with SignalR
Demo
![Page 21: SignalR on Old-school Servers & Clients When some lower-common denominator polling mechanism is needed Web Server HTML Client Got Data? Here’s some](https://reader030.vdocument.in/reader030/viewer/2022032705/56649d825503460f94a6806a/html5/thumbnails/21.jpg)
Calling a SignalR Hub from the ServerDemo
![Page 22: SignalR on Old-school Servers & Clients When some lower-common denominator polling mechanism is needed Web Server HTML Client Got Data? Here’s some](https://reader030.vdocument.in/reader030/viewer/2022032705/56649d825503460f94a6806a/html5/thumbnails/22.jpg)
Self-hosting SignalR using OWINDemo
![Page 23: SignalR on Old-school Servers & Clients When some lower-common denominator polling mechanism is needed Web Server HTML Client Got Data? Here’s some](https://reader030.vdocument.in/reader030/viewer/2022032705/56649d825503460f94a6806a/html5/thumbnails/23.jpg)
Persistent Connections
![Page 24: SignalR on Old-school Servers & Clients When some lower-common denominator polling mechanism is needed Web Server HTML Client Got Data? Here’s some](https://reader030.vdocument.in/reader030/viewer/2022032705/56649d825503460f94a6806a/html5/thumbnails/24.jpg)
Persistent SignalR ConnectionsLow levelWork on top of transport abstractionPass untyped messages using Send() and Broadcast()Client must parse message and know what to do
![Page 25: SignalR on Old-school Servers & Clients When some lower-common denominator polling mechanism is needed Web Server HTML Client Got Data? Here’s some](https://reader030.vdocument.in/reader030/viewer/2022032705/56649d825503460f94a6806a/html5/thumbnails/25.jpg)
Persistent connections
Demo
![Page 26: SignalR on Old-school Servers & Clients When some lower-common denominator polling mechanism is needed Web Server HTML Client Got Data? Here’s some](https://reader030.vdocument.in/reader030/viewer/2022032705/56649d825503460f94a6806a/html5/thumbnails/26.jpg)
Real-time Everywhere
![Page 27: SignalR on Old-school Servers & Clients When some lower-common denominator polling mechanism is needed Web Server HTML Client Got Data? Here’s some](https://reader030.vdocument.in/reader030/viewer/2022032705/56649d825503460f94a6806a/html5/thumbnails/27.jpg)
Using SignalR’s Native .NET ClientDemo
![Page 28: SignalR on Old-school Servers & Clients When some lower-common denominator polling mechanism is needed Web Server HTML Client Got Data? Here’s some](https://reader030.vdocument.in/reader030/viewer/2022032705/56649d825503460f94a6806a/html5/thumbnails/28.jpg)
Backplanes
![Page 29: SignalR on Old-school Servers & Clients When some lower-common denominator polling mechanism is needed Web Server HTML Client Got Data? Here’s some](https://reader030.vdocument.in/reader030/viewer/2022032705/56649d825503460f94a6806a/html5/thumbnails/29.jpg)
Hubs are server-bound, so you’ll need to use a backplane if you’re running a web farm
![Page 30: SignalR on Old-school Servers & Clients When some lower-common denominator polling mechanism is needed Web Server HTML Client Got Data? Here’s some](https://reader030.vdocument.in/reader030/viewer/2022032705/56649d825503460f94a6806a/html5/thumbnails/30.jpg)
How do Backplanes Work?What does SignalR do without a backplane?
Web Server B
Web Server A
![Page 31: SignalR on Old-school Servers & Clients When some lower-common denominator polling mechanism is needed Web Server HTML Client Got Data? Here’s some](https://reader030.vdocument.in/reader030/viewer/2022032705/56649d825503460f94a6806a/html5/thumbnails/31.jpg)
How do Backplanes Work?Here’s how the Backplane solves the problem
Web Server A
Web Server B
Backplane
![Page 32: SignalR on Old-school Servers & Clients When some lower-common denominator polling mechanism is needed Web Server HTML Client Got Data? Here’s some](https://reader030.vdocument.in/reader030/viewer/2022032705/56649d825503460f94a6806a/html5/thumbnails/32.jpg)
Using a SignalR Backplane
Demo
![Page 33: SignalR on Old-school Servers & Clients When some lower-common denominator polling mechanism is needed Web Server HTML Client Got Data? Here’s some](https://reader030.vdocument.in/reader030/viewer/2022032705/56649d825503460f94a6806a/html5/thumbnails/33.jpg)
Thanks for your time, I hope you enjoyed the session and that you start partying with SignalR!
![Page 34: SignalR on Old-school Servers & Clients When some lower-common denominator polling mechanism is needed Web Server HTML Client Got Data? Here’s some](https://reader030.vdocument.in/reader030/viewer/2022032705/56649d825503460f94a6806a/html5/thumbnails/34.jpg)
DEV-B219 Latest Innovations for ASP.NET MVC Development
DEV-B344 The Future of Microsoft .NET on the Server
DEV-H215 Real-Time Web Applications with Microsoft ASP.NET SignalR
DEV-B318 Best Practices for Scaling Web Apps
Related content
Find Me Later!
![Page 35: SignalR on Old-school Servers & Clients When some lower-common denominator polling mechanism is needed Web Server HTML Client Got Data? Here’s some](https://reader030.vdocument.in/reader030/viewer/2022032705/56649d825503460f94a6806a/html5/thumbnails/35.jpg)
http://signalr.net/
http://www.asp.net/signalr
http://blogs.msdn.com/b/webdev/
Track resources
![Page 36: SignalR on Old-school Servers & Clients When some lower-common denominator polling mechanism is needed Web Server HTML Client Got Data? Here’s some](https://reader030.vdocument.in/reader030/viewer/2022032705/56649d825503460f94a6806a/html5/thumbnails/36.jpg)
Resources
Learning
Microsoft Certification & Training Resources
www.microsoft.com/learning
Developer Network
http://developer.microsoft.com
TechNet
Resources for IT Professionals
http://microsoft.com/technet
Sessions on Demand
http://channel9.msdn.com/Events/TechEd
![Page 37: SignalR on Old-school Servers & Clients When some lower-common denominator polling mechanism is needed Web Server HTML Client Got Data? Here’s some](https://reader030.vdocument.in/reader030/viewer/2022032705/56649d825503460f94a6806a/html5/thumbnails/37.jpg)
TechEd Mobile app for session evaluations is currently offline
SUBMIT YOUR TECHED EVALUATIONSFill out an evaluation via
CommNet Station/PC: Schedule Builder
LogIn: europe.msteched.com/catalog
We value your feedback!
![Page 38: SignalR on Old-school Servers & Clients When some lower-common denominator polling mechanism is needed Web Server HTML Client Got Data? Here’s some](https://reader030.vdocument.in/reader030/viewer/2022032705/56649d825503460f94a6806a/html5/thumbnails/38.jpg)
© 2014 Microsoft Corporation. All rights reserved. Microsoft, Windows, and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries.The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.