Building a Service Layer Using ASP.NET Web...

13
SignalR Incredibly simple real-time web for .NET

Transcript of Building a Service Layer Using ASP.NET Web...

Page 1: Building a Service Layer Using ASP.NET Web APIdownload.microsoft.com/download/A/6/6/A665FE3A-6AFA-45D6...ASP.NET Web API (30 mins) (08) Real-time Communications with SignalR (45 mins)

SignalR Incredibly simple real-time web for .NET

Page 2: Building a Service Layer Using ASP.NET Web APIdownload.microsoft.com/download/A/6/6/A665FE3A-6AFA-45D6...ASP.NET Web API (30 mins) (08) Real-time Communications with SignalR (45 mins)

First Half Second Half

(01) What’s New in ASP.NET 4.5 (60 mins) ** MEAL BREAK **

(02) Building and Deploying Websites

with ASP.NET MVC 4 (60 mins)

(06) Building Social Web Applications

with ASP.NET (30 mins)

(03) Creating HTML5 Applications with

jQuery (60 mins)

(07) Building for the Mobile Web (60

mins)

(04) Building a Service Layer with

ASP.NET Web API (30 mins)

(08) Real-time Communications with

SignalR (45 mins)

(05) Leveraging your ASP.NET

Development Skills to Build Office

Apps (15 mins)

(09) Taking advantage of Windows Azure

services (30 mins)

Page 3: Building a Service Layer Using ASP.NET Web APIdownload.microsoft.com/download/A/6/6/A665FE3A-6AFA-45D6...ASP.NET Web API (30 mins) (08) Real-time Communications with SignalR (45 mins)
Page 4: Building a Service Layer Using ASP.NET Web APIdownload.microsoft.com/download/A/6/6/A665FE3A-6AFA-45D6...ASP.NET Web API (30 mins) (08) Real-time Communications with SignalR (45 mins)

Microsoft /web ®

Page 5: Building a Service Layer Using ASP.NET Web APIdownload.microsoft.com/download/A/6/6/A665FE3A-6AFA-45D6...ASP.NET Web API (30 mins) (08) Real-time Communications with SignalR (45 mins)

Microsoft /web ®

Page 6: Building a Service Layer Using ASP.NET Web APIdownload.microsoft.com/download/A/6/6/A665FE3A-6AFA-45D6...ASP.NET Web API (30 mins) (08) Real-time Communications with SignalR (45 mins)

Long

Polling

Forever

Frames

Server

Sent

Events

Web

Sockets

Page 7: Building a Service Layer Using ASP.NET Web APIdownload.microsoft.com/download/A/6/6/A665FE3A-6AFA-45D6...ASP.NET Web API (30 mins) (08) Real-time Communications with SignalR (45 mins)

Microsoft /web ®

Page 8: Building a Service Layer Using ASP.NET Web APIdownload.microsoft.com/download/A/6/6/A665FE3A-6AFA-45D6...ASP.NET Web API (30 mins) (08) Real-time Communications with SignalR (45 mins)

Client

Browser

Web

Server HTTP GET – Got data? HTTP GET – Got data? HTTP GET – Got data? HTTP GET – Got data? HTTP GET – Got data? HTTP GET – Got data? HTTP GET – Got data? HTTP GET – Got data? HTTP GET – Got data? HTTP GET – Got data? HTTP GET – Got data? HTTP GET – Got data?

Page 9: Building a Service Layer Using ASP.NET Web APIdownload.microsoft.com/download/A/6/6/A665FE3A-6AFA-45D6...ASP.NET Web API (30 mins) (08) Real-time Communications with SignalR (45 mins)

Client

Browser

Web

Server HTTP GET – You do realtime?

Sure, I’m a new server. I love realtime.

Let’s go!

Awesome

Page 10: Building a Service Layer Using ASP.NET Web APIdownload.microsoft.com/download/A/6/6/A665FE3A-6AFA-45D6...ASP.NET Web API (30 mins) (08) Real-time Communications with SignalR (45 mins)
Page 11: Building a Service Layer Using ASP.NET Web APIdownload.microsoft.com/download/A/6/6/A665FE3A-6AFA-45D6...ASP.NET Web API (30 mins) (08) Real-time Communications with SignalR (45 mins)

var hub = $.connection.chat;

hub.addMessage = function (msg){

$("#msgs").append("<li>" + msg + "</li>");

};

$.connection.hub.start().done(function () {

$("#send").click(function () {

hub.sendMessage($("#msg").val());

});

});

public class Chat : Hub {

public void SendMessage(string m) {

Clients.addMessage(m);

}

}

JavaScript Client

C# Server

Page 12: Building a Service Layer Using ASP.NET Web APIdownload.microsoft.com/download/A/6/6/A665FE3A-6AFA-45D6...ASP.NET Web API (30 mins) (08) Real-time Communications with SignalR (45 mins)

var hubConnection = new HubConnection("http://server"); dynamic chat = hubConnection.CreateProxy("chat"); chat.On("addMessage", m => messages.Add(m)); hubConnection.Start().Wait(); send.Click += (s, e) => chat.send(message.Text);

public class Chat : Hub {

public void SendMessage(string m) {

Clients.addMessage(m);

}

}

.NET Client:

Windows Phone

Silverlight

C# Server

Page 13: Building a Service Layer Using ASP.NET Web APIdownload.microsoft.com/download/A/6/6/A665FE3A-6AFA-45D6...ASP.NET Web API (30 mins) (08) Real-time Communications with SignalR (45 mins)