SignalR with ASP.NET MVC 6

19
SIGNALR + ASP.NET MVC LEVERAGING ON REAL-TIME DATA UPDATES

Transcript of SignalR with ASP.NET MVC 6

Page 1: SignalR with ASP.NET MVC 6

SIGNALR + ASP.NET MVCLEVERAGING ON REAL-TIME DATA UPDATES

Page 2: SignalR with ASP.NET MVC 6

TOPICS

• Introduction to ASP.NET MVC 6 + ASP.NET 5• Key Concepts of SignalR• Quick Look at SignalR• SignalR with ASP.NET MVC 6 deep-dive demo• Questions & Answer

Page 3: SignalR with ASP.NET MVC 6

ASP.NET MVC 6 + ASP.NET 5

• ASP.NET is now on Mac and Linux• No More Web Forms• No More Visual Basic• Tag Helpers versus MVC Helpers• View Components• Microsoft.AspNet.Mvc.Controller• AngularJS

Page 4: SignalR with ASP.NET MVC 6

SIGNALRAdvocating a Real Time Data Communication between UIs

Page 5: SignalR with ASP.NET MVC 6

KEY CONCEPTS

•Remote Procedural Calls (RPC)•WebSocket Wrapper•Transports & Fallbacks

Page 6: SignalR with ASP.NET MVC 6

KEY CONCEPTS: “SERVER PUSHING”

“SignalR supports "server push" functionality, in which server code can call out to client code in the browser using Remote Procedure Calls (RPC),

rather than the request-response model common on the web today. ”

Page 7: SignalR with ASP.NET MVC 6

KEY CONCEPTS: TRANSPORTS

• HTML5 Transports• WebSocket – only transport that establishes true two way persistent

connection• Server Sent Events - EventSource

• Comet Transports (makes use of HTTP)• Forever Frame (only IE)• Ajax Long Polling

Page 8: SignalR with ASP.NET MVC 6

KEY CONCEPTS: TRANSPORTS

$.connection.hub.logging = true;

• Enable Logging in your code• Opening the Console Window in your web browser

Page 9: SignalR with ASP.NET MVC 6

KEY CONCEPTS: SPECIFYING A TRANSPORT

If you know the client’s capability…connection.start({ transport: 'longPolling' });

If not, always make sure there is a fallback…connection.start({ transport:

['webSockets','longPolling'] });

Page 10: SignalR with ASP.NET MVC 6

KEY CONCEPTS: SPECIFYING A TRANSPORT

•webSockets•foreverFrame•serverSentEvents• longPolling

Page 11: SignalR with ASP.NET MVC 6

KEY CONCEPTS: CONNECTIONS & HUBS

• Persistent Connection• Low-level communication protocol• PersistentConnection class

• Hub• High-level pipeline• Allowing clients to call methods on servers• Similarity to .NET Remoting

Page 12: SignalR with ASP.NET MVC 6

KEY CONCEPTS: HOW HUBS WORK

• Server-side calls a method on the client• A packet is sent across (name of method + parameters)

• If the parameter is an object, it will be serialized as JSON• Client checks to see if the method exists in client-side coding• If exists, the method is executed using the deserialized parameter

data.

Page 13: SignalR with ASP.NET MVC 6

KEY CONCEPTS: WHEN TO USE PERSISTENT CONNECTION?• The format of the actual message sent needs to be specified.• The developer prefers to work with a messaging and dispatching

model rather than a remote invocation model.• An existing application that uses a messaging model is being ported

to use SignalR.

Page 14: SignalR with ASP.NET MVC 6

GETTING STARTED

install-package Microsoft.AspNet.SignalR

Page 15: SignalR with ASP.NET MVC 6

DEMO

Page 16: SignalR with ASP.NET MVC 6

TELERIK PROFILE

•Since 2002•Over 1.7 million developers•Developer-focused

Page 17: SignalR with ASP.NET MVC 6

ABIT ABOUT TELERIK

• UI Toolkits – Web Forms, MVC, Silverlight, Kendo UI, WinForms, WPF, UWP (Windows 10), and many more.

• Telerik Test Studio – Automated Testing solution (Native Mobile Apps)• Telerik Platform – Cross-platform Mobile App Development &

Management• Telerik Sitefinity – Web Content Management System

Page 18: SignalR with ASP.NET MVC 6

CONTACT

• http://theprogrammingnerd.com• http://github.com/telerikgeek• Skype: metanoia.sherman• Instagram: telerikgeek• Twitter: telerikgeek

Page 19: SignalR with ASP.NET MVC 6

QUESTIONS?