Connected Web Systems

24
Connecting Web Systems by Damir Dobric Lap around new technologies which might change the web soon.

description

Connecting Web Systems by Damir Dobric. Presentation from the Advanced Developers Conference

Transcript of Connected Web Systems

Page 1: Connected Web Systems

Connecting Web Systems

by Damir Dobric

Lap around new technologies which might change the

web soon.

Page 2: Connected Web Systems

AGENDA

Limits of Web

Data Streaming in Web

Web Sockets

Signal R

RequestResponse

Polling

Long Polling

Streaming

Persistent Connections

Connecting Patterns

ASP.NET 4.5

Long Responses

Async in Backend

HttpTaskAsync

Handler

Stream Push to Browser

Stream Push to any app

HTML5 Spec.

IIS8-WebSocket Support

JS WebSocketClient

ASP.NET Web Socket Server

WCF WebSocket

ServiceWCF

WebSocketClient

ForeverFrames

SentServerEvents

JS Client

.NET Server

Persistent Connections

Hubs

Page 3: Connected Web Systems

Limits of Web

http Request/Response

X

Page 4: Connected Web Systems

Connecting Patterns

http Request/Response

Xhttp Request/Response

http polling

http Request/Response

Full-Duplex

Page 5: Connected Web Systems

Polling Approach

while(true){var response = httpClient.SendRequest(“http://...”);

processResponse(response.Data);Thread.Sleep(T);

}

tcpClient.TimeOut = 999999..;var netStream = tcpClient.SendHttpRequest(“http://...”); while(true){ var data1 = netStream.Read(); var data2 = processData(data1); netStream.Write(data2); }}

Page 6: Connected Web Systems

Infrastructure Limits

Full-Duplex

XNo streaming support ?

Connection Limit ?

X

Page 7: Connected Web Systems

DATA STREAMING IN WEB

ASP.NET 4.5

Long Responses

Async in Backend

HttpTaskAsync

Handler

Stream Push to Browser

Stream Push to any app

Page 8: Connected Web Systems

o Async In Front Endo Responsive UIo Battery Life

o Async in Backendo Waiting on IOo Fan Out Awaito C/S Stream

Why Async ?

Page 9: Connected Web Systems

DEMO

ASP.NET 4.5

Long Responses

Async in Backend

HttpTaskAsync

Handler

Stream Push to Browser

Stream Push to any app

Page 10: Connected Web Systems

WEB SOCKETS

HTML5 Spec.

IIS8-WebSocket Support

JS WebSocketClient

ASP.NET Web Socket Server

WCF WebSocket

ServiceWCF

WebSocketClient

Page 11: Connected Web Systems

What is WebSocket?

oDriven by HTML5oFull-Duplex over TCPoBrowser native Socket connectiono IETF Spec. - HyBi 17(IE10 Win8=HyBi10)

Page 12: Connected Web Systems

ArchitectureEndpoints

JavaScript

WinRT.NET

Consumers

WCF netHttpDuplex

WinRT WebSocketsJavaScript

.NETConsumers

ASP.NETModule

WCFWebSocket

Hosting

Page 14: Connected Web Systems

DEMO

HTTP/Upgrade

ASP.NETJavaScript

WebSocketChat

WebSocketHanlder

WebSocket WCF Duplex

NetHttp

Page 15: Connected Web Systems

References

x

• http://developers.de/blogs/damir_dobric/archive/2011/11/26/wcf-duplex-via-websocket.aspx• http://rickgaribay.net/archive/2012/08/14/the-goods-websockets-programming-in-.

net-4.5-and-windows-azure.aspx• http://

www.devconnections.com/updates/Garibay_Build%20Speedy%20Azure%20Applications%20with%20HTML5%20and%20Web%20Sockets%20Today.pdf

• http://rickgaribay.net/archive/2012/08/14/the-goods-websockets-programming-in-.net-4.5-and-windows-azure.aspx

• http://www.paulbatum.com/2011/10/getting-to-know-systemnetwebsockets.html

Page 16: Connected Web Systems

SignalR

ForeverFrames

SentServerEvents

JS Client

.NET Server

Persistent Connections

Hubs

Page 17: Connected Web Systems

What when?

XNo streaming support ?

X

No ClientWebSocket Support ?

No Server WebSocket Support ?

Page 18: Connected Web Systems

Server Sent Events

• Push from a server to a browser• Part of HTML5 spec• http://dev.w3.org/html5/eventsource• Header: text/event-stream• Implemented natively in Browser• Long polling without closing connection

http://dsheiko.com/weblog/websockets-vs-sse-vs-long-polling

Page 19: Connected Web Systems

Forever-Frame streaming

oPush notificationsoNot based on Long-PollingoUses HTTP 1.1 chunked encodingo Internet Explorer

Page 20: Connected Web Systems

SignalR

o Permanent Connection support for none HTML5 browsers.o Use it when infrastructure does not support any other push technology

o Two Part Libraryo jQuery PlugIn for Cliento .NET Library for Server

o Supported Transports:o Long pollingo WebSocketso Forever Frame streamingo Server Sent events

Page 21: Connected Web Systems

DEMO

ForeverFrames

SentServerEvents

JS Client

.NET Server

Persistent Connections

Hubs

Page 23: Connected Web Systems

RECAP + Q&A

Limits of Web

Data Streaming in Web

Web Sockets

Signal R

RequestResponse

Polling

Long Polling

Streaming

Persistent Connections

Connecting Patterns

ASP.NET 4.5

Long Responses

Async in Backend

HttpTaskAsync

Handler

Stream Push to Browser

Stream Push to any app

HTML5 Spec.

IIS8-WebSocket Support

JS WebSocketClient

ASP.NET Web Socket Server

WCF WebSocket

ServiceWCF

WebSocketClient

ForeverFrames

SentServerEvents

JS Client

.NET Server

Persistent Connections

Hubs

Page 24: Connected Web Systems

Thank You Damir Dobric