![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)](https://reader034.vdocuments.net/reader034/viewer/2022051904/5ff5e49eb96cb26dbf55111a/html5/thumbnails/1.jpg)
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)](https://reader034.vdocuments.net/reader034/viewer/2022051904/5ff5e49eb96cb26dbf55111a/html5/thumbnails/2.jpg)
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)](https://reader034.vdocuments.net/reader034/viewer/2022051904/5ff5e49eb96cb26dbf55111a/html5/thumbnails/3.jpg)
![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)](https://reader034.vdocuments.net/reader034/viewer/2022051904/5ff5e49eb96cb26dbf55111a/html5/thumbnails/4.jpg)
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)](https://reader034.vdocuments.net/reader034/viewer/2022051904/5ff5e49eb96cb26dbf55111a/html5/thumbnails/5.jpg)
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)](https://reader034.vdocuments.net/reader034/viewer/2022051904/5ff5e49eb96cb26dbf55111a/html5/thumbnails/6.jpg)
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)](https://reader034.vdocuments.net/reader034/viewer/2022051904/5ff5e49eb96cb26dbf55111a/html5/thumbnails/7.jpg)
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)](https://reader034.vdocuments.net/reader034/viewer/2022051904/5ff5e49eb96cb26dbf55111a/html5/thumbnails/8.jpg)
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)](https://reader034.vdocuments.net/reader034/viewer/2022051904/5ff5e49eb96cb26dbf55111a/html5/thumbnails/9.jpg)
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)](https://reader034.vdocuments.net/reader034/viewer/2022051904/5ff5e49eb96cb26dbf55111a/html5/thumbnails/10.jpg)
![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)](https://reader034.vdocuments.net/reader034/viewer/2022051904/5ff5e49eb96cb26dbf55111a/html5/thumbnails/11.jpg)
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)](https://reader034.vdocuments.net/reader034/viewer/2022051904/5ff5e49eb96cb26dbf55111a/html5/thumbnails/12.jpg)
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)](https://reader034.vdocuments.net/reader034/viewer/2022051904/5ff5e49eb96cb26dbf55111a/html5/thumbnails/13.jpg)