+ All Categories
Home > Engineering > Web e device in real time con asp.net Signal R

Web e device in real time con asp.net Signal R

Date post: 08-Apr-2017
Category:
Upload: luca-zulian
View: 323 times
Download: 3 times
Share this document with a friend
31
Web e device in real time con ASP.NET SignalR Giuseppe Marchi Microsoft MVP SharePoint Luca Zulian MCTS ASP.NET 4
Transcript
Page 1: Web e device in real time con asp.net Signal R

Web e device in real time con ASP.NET SignalRGiuseppe MarchiMicrosoft MVP SharePoint

Luca ZulianMCTS ASP.NET 4

Page 2: Web e device in real time con asp.net Signal R

What is SignalR?Under the Hood

Building Apps with SignalR

SignalR outside .NET Framework

_1

_3

_5

_18

Performance & testing _21

Page 3: Web e device in real time con asp.net Signal R

What is SignalR for Developers?

• A library for ASP.NET developers that simplifies the process of adding real-time functionality

• An Open Source library (github.com/SignalR/SignalR)

• Well Documented library (asp.net/signalr)• Always up to date

Page 4: Web e device in real time con asp.net Signal R

What SignalR offers to Developers

• Real-time, persistent connection abstraction over HTTP for .NET (supports Web Sockets, and falls back to other compatible techniques for older browsers)

• Simplicity• Reach• Performance• Scalability• Security• Extensibility

Page 5: Web e device in real time con asp.net Signal R

SignalR: under the hood

Page 6: Web e device in real time con asp.net Signal R

Before Start: Components• Meta Package (Microsoft.AspNet.SignalR)• Core (Microsoft.AspNet.SignalR.Core)• Hosts (Microsoft.AspNet.SignalR.SystemWeb,

Microsoft.AspNet.SignalR.Owin)• Clients (Microsoft.AspNet.SignalR.Js,

Microsoft.AspNet.SignalR.Client)• Scaleout Buses

(Microsoft.AspNet.SignalR.Redis, Microsoft.AspNet.SignalR.ServiceBus)

Page 7: Web e device in real time con asp.net Signal R

DEMO

Page 8: Web e device in real time con asp.net Signal R

Simplicity: two level APIChoose the level of abstraction that works for you

Page 9: Web e device in real time con asp.net Signal R

Two level API: ConfigurationRemember: call RouteTable.Routes.MapHubs() as the first line of code in the Application_Start method, this must be called before you register any other routes.

Page 10: Web e device in real time con asp.net Signal R

Two level API: Hub ConfigurationRemember: call RouteTable.Routes.MapConnection() as the first line of code in the Application_Start method, this must be called before you register any other routes.

Page 11: Web e device in real time con asp.net Signal R

Two level API: PersistentConnection

• Low-level• Simple endpoint for sending

single-recipient, grouped, or broadcast messages

• Gives direct access to the low-level communication protocols

• PersistentConnection class

• Connect, reconnect & disconnect semantics

Page 12: Web e device in real time con asp.net Signal R

Two level API: PersistentConnection

PersistentConnection API

Page 13: Web e device in real time con asp.net Signal R

Two level API: PersistentConnection

Page 14: Web e device in real time con asp.net Signal R

DEMO

Page 15: Web e device in real time con asp.net Signal R

Two level API: Hub• More high-level pipeline• Allows your client and

server to call methods each other directly (internal routing)

• Allows you to pass strongly typed parameters to methods, enabling model binding

• Hub class• Automatic client proxy

generation (Javascript)

Page 16: Web e device in real time con asp.net Signal R

Two level API: HubHub API

Page 17: Web e device in real time con asp.net Signal R

Two level API: Hub

Page 18: Web e device in real time con asp.net Signal R

DEMO

Page 19: Web e device in real time con asp.net Signal R

Simplicity: Javascript client• Javascript proxy (AUTOMATICALLY created on

~/signalr/hubs)

Page 20: Web e device in real time con asp.net Signal R

Simplicity: Windows8 & WP8 client

• Microsoft.AspNet.SignalR.Client• Hub

• PersistentConnection

Page 21: Web e device in real time con asp.net Signal R

Transport NegotiationSignalR isolates us from low-level details, giving us the impression of working on a permanently open persistent connection

Page 22: Web e device in real time con asp.net Signal R

But isn’t real-time web just chat?

• Dashboards & monitoring• Collaborative anything• Job progress• Real-time forms• Gaming• …

Page 23: Web e device in real time con asp.net Signal R

SignalR outside .NET framework

• SignalR-ObjC - Native for iOS clients

• SignalA - Native for Android clients

• Xamarin (in xamarin branch https://github.com/SignalR/SignalR/tree/xamarin, but need some tricks)

Page 24: Web e device in real time con asp.net Signal R

SignalR on IIS?Supported server operating systems• Windows Server 2012• Windows Server 2008 r2.• Windows 8• Windows 7• Windows Azure

Supported .NET Framework versions• SignalR is supported on both .NET Framework version 4 and 4.5. For

WebSockets to be supported, .NET Framework 4.5 must be used.

Supported IIS versions• IIS 8 or IIS 8 Express• IIS 7 and 7.5. Support for extensionless URLs is required• IIS must be running in integrated mode; classic mode is not supported• The hosting application must be running in full trust mode

Page 25: Web e device in real time con asp.net Signal R

SignalR only on IIS?

• Console Applications, Windows Services (Microsoft.AspNet.SignalR.SelfHost)

• OWIN (Microsoft.AspNet.SignalR.Owin)

• Mono

Page 26: Web e device in real time con asp.net Signal R

SignalR performance & testing

• SignalR Crank or Stress projects from repository

• Performance Monitor (Perfmon.exe)

Page 27: Web e device in real time con asp.net Signal R

SignalR performance & testing

• Connections Connected

• Connections Reconnected

• Connections Disonnected

• Connections Current• Connection Messages

Received Total• Connection Messages

Sent Total• Connection Messages

Received/Sec• Connection Messages

Sent/Sec

SignalR Performance Counter

Page 28: Web e device in real time con asp.net Signal R

SignalR performance considerations

Reducing message size• JsonIgnore attribute• JsonProperty attribute to reduce message size

Modify SignalR configuration settings• DefaultMessageBufferSize

Modify ASP.NET configuration settings• Maximum concurrent requests per CPU• Request Queue Limit

Modify IIS configuration settings• Max concurrent requests per application

Page 29: Web e device in real time con asp.net Signal R

Q&A

Page 30: Web e device in real time con asp.net Signal R

Contatti

OverNet Education• TEL. +39 02 365738• EMAIL [email protected]• WEB www.WPC2013.it• TWITTER @Overnete

Page 31: Web e device in real time con asp.net Signal R

Thank You


Recommended