24
Real-Time Web Applications ASP.NET WebAPI & SignalR Jim Wang

Real-Time Web Applications with ASP.NET WebAPI and SignalR

Embed Size (px)

DESCRIPTION

More info on http://www.techdays.be

Citation preview

Page 1: Real-Time Web Applications with ASP.NET WebAPI and SignalR

Real-Time Web ApplicationsASP.NET WebAPI & SignalRJim Wang

Page 2: Real-Time Web Applications with ASP.NET WebAPI and SignalR

ASP.NET Web API

Jim Wang

Page 3: Real-Time Web Applications with ASP.NET WebAPI and SignalR

How to reach more clients?

Browsers Devices Phones Tablets

? ? ? ?

App

Page 4: Real-Time Web Applications with ASP.NET WebAPI and SignalR

How to make it scale?

Browsers Devices Phones Tablets

App

? ? ? ?

Page 5: Real-Time Web Applications with ASP.NET WebAPI and SignalR

How to keep it simple?

Browsers Devices Phones Tablets

App

? ? ? ?SOAPSOAP

.config

Page 6: Real-Time Web Applications with ASP.NET WebAPI and SignalR

Leverage the Web – build Web APIs

Browsers Devices Phones Tablets

ASP.NET Web APIApp

Page 7: Real-Time Web Applications with ASP.NET WebAPI and SignalR

ASP.NET Web API

A framework for creating HTTP services that can reach a

broad range of clients including browsers and mobile devices

Page 8: Real-Time Web Applications with ASP.NET WebAPI and SignalR

features

First class modern HTTP programming model

Easily map resources to URIs

Content negotiation Request validation Flexible hosting Lightweight .NET 4+

Available as NuGet packages

Great templates and tooling in 2012.2 release, like help pages

Fully open source

Page 9: Real-Time Web Applications with ASP.NET WebAPI and SignalR

ASP.NET Web API OData

Components for implementing OData servicesModel builders, formatters (Atom/JSON/XML), path and query parsers, LINQ expression generator, etc

Support common patterns using an open protocolEx. query, paging, relationships, metadata

Built on ODataLibSame underpinnings as WCF Data Services

Open source and accepting contributionshttp://aspnetwebstack.codeplex.com

Page 10: Real-Time Web Applications with ASP.NET WebAPI and SignalR

Three Steps to Get Started

Create your EDM

Configure your OData Route

Implement an OData Controller

ODataConventionModelBuilder modelBuilder = new ODataConventionModelBuilder();modelBuilder.EntitySet<Movie>("Movies");IEdmModel model = modelBuilder.GetEdmModel();

config.Routes.MapODataRoute(routeName: "OData", routePrefix: "odata", model: model);

public class MoviesController : EntitySetController<Movie, int> {...}

Page 11: Real-Time Web Applications with ASP.NET WebAPI and SignalR

Data Model for OData

The ASP.NET Web API core runtime has no data modelObjects formatted to/from opaque blobs by formatters

OData is based on the Entity Data Model (EDM)Entity sets, entities, relationships, complex types, actions, functions

Having a data model means the framework can do more for youProvide metadata, setup routes, rich link generation, query, paging

Your OData EDM can be different from your EF EDMYou don’t even need an EF EDM – use any data source you’d like

Page 12: Real-Time Web Applications with ASP.NET WebAPI and SignalR

Query Support

[Queryable] action filter enables OData query support Can be used independent of the format

ODataQueryOptions provides the parsed query AST Apply the query to an IQueryableTranslate the Abstract Syntax Tree to your query mechanism of choice

Query validationRestrict supported query options, functions, expression operators, queryable properties, etc.

Paging Set PageSize to your desired max page size

Page 13: Real-Time Web Applications with ASP.NET WebAPI and SignalR

what’s next?

Security with OAuth2, JWT OData $expand, $select Odata scaffolding for templates SignalR integration CORS, JSONP

Page 14: Real-Time Web Applications with ASP.NET WebAPI and SignalR

signalR

Jim Wang

Page 15: Real-Time Web Applications with ASP.NET WebAPI and SignalR

what is it?

SignalR : Incredibly simple real-time for ASP.NET Automatic protocol negotiation

Simplicity Reach Performance

Page 16: Real-Time Web Applications with ASP.NET WebAPI and SignalR

where are we?

github.com/SignalR/SignalRTaking pull requests!

1.0 RTW with ASP.NET 2012.2Available now.

Page 17: Real-Time Web Applications with ASP.NET WebAPI and SignalR

clients

Today jQuery .NET 4.0+ Silverlight 5 Windows Phone 8 .NET for Windows Store

apps

Future? Pure JavaScript (no jQuery) C++ (Windows Store &

Embedded) MonoTouch/MonoDroid Objective C Java …

Page 18: Real-Time Web Applications with ASP.NET WebAPI and SignalR

what’s next?

Monthly point releases More documentation and samples More templates and scaffolding Scale out

Service Bus SQL Server Redis

Page 19: Real-Time Web Applications with ASP.NET WebAPI and SignalR

knockout.js

Jim Wang

Page 20: Real-Time Web Applications with ASP.NET WebAPI and SignalR

features

Page 21: Real-Time Web Applications with ASP.NET WebAPI and SignalR

let’s build.

Jim Wang

Page 22: Real-Time Web Applications with ASP.NET WebAPI and SignalR

get ASP.NET and Web Tools 2012.2www.asp.net/vnextDownloads it through the Web Platform Installer

Page 23: Real-Time Web Applications with ASP.NET WebAPI and SignalR

links

Knockout.jshttp://knockoutjs.com

Bootstraphttp://twitter.github.com/bootstrap/

OData Security Guidance for Web APIhttp://www.asp.net/web-api/overview/odata-support-in-aspnet-web-api/odata-security-guidance

Page 24: Real-Time Web Applications with ASP.NET WebAPI and SignalR

questions?

Jim [email protected]@microsoft.com