SignalR
-
Upload
robin-sedlaczek -
Category
Software
-
view
706 -
download
1
description
Transcript of SignalR
![Page 1: SignalR](https://reader036.fdocuments.net/reader036/viewer/2022062708/558c1833d8b42ae8718b462b/html5/thumbnails/1.jpg)
SignalRRobin Sedlaczek
![Page 2: SignalR](https://reader036.fdocuments.net/reader036/viewer/2022062708/558c1833d8b42ae8718b462b/html5/thumbnails/2.jpg)
Robin Sedlaczek15 Jahre Erfahrung als Entwickler
8 Jahre Erfahrung als Projektleiter
seit 4 Jahren CTO und Gesellschafter bei der Fairmas GmbH in Berlin
Autor für Windows Developer & DotNetPro
MSDN Community-Mitglied/Moderator
MVA Contributor (.NET Compiler Plattform)
Contributor bei SharpGL (GitHub)
twitter.com/RobinSedlaczek
robinsedlaczek.wordpress.com
![Page 3: SignalR](https://reader036.fdocuments.net/reader036/viewer/2022062708/558c1833d8b42ae8718b462b/html5/thumbnails/3.jpg)
SignalR
![Page 4: SignalR](https://reader036.fdocuments.net/reader036/viewer/2022062708/558c1833d8b42ae8718b462b/html5/thumbnails/4.jpg)
Was ist SignalR?
- Framework für Echtzeitkommunikation im Internet- API für RPC (Server to Client)- benutzt WebSockets, Long Polling, Server Sent Events, Forever Frame etc.- persistente Connections- automatisches Connection Management (connect, disconnect, grouping)- Broadcasts oder Messages einzelnen Clients- Open Source unter .NET Foundation (http://www.dotnetfoundation.org/)- Code auf GitHub (https://github.com/SignalR)
![Page 5: SignalR](https://reader036.fdocuments.net/reader036/viewer/2022062708/558c1833d8b42ae8718b462b/html5/thumbnails/5.jpg)
Einsatzgebiete
- häufiges Aktualisieren einer Webseite durch den Benutzer- Dashboards- Monitoring-Anwendungen- Echtzeit-Formulare- Kollaborative Anwendungen (z.B. sowas wie Google Docs)- Real-Time Gaming
![Page 6: SignalR](https://reader036.fdocuments.net/reader036/viewer/2022062708/558c1833d8b42ae8718b462b/html5/thumbnails/6.jpg)
OWIN & KATANA
OWIN => Spezifikation aus der Community (owin.org)
KATANA =>Referenzimplementierung von Microsoft
![Page 7: SignalR](https://reader036.fdocuments.net/reader036/viewer/2022062708/558c1833d8b42ae8718b462b/html5/thumbnails/7.jpg)
Quelle: Microsoft
![Page 8: SignalR](https://reader036.fdocuments.net/reader036/viewer/2022062708/558c1833d8b42ae8718b462b/html5/thumbnails/8.jpg)
Quelle: Microsoft
![Page 9: SignalR](https://reader036.fdocuments.net/reader036/viewer/2022062708/558c1833d8b42ae8718b462b/html5/thumbnails/9.jpg)
Unterstützte Betriebssysteme
Windows Server 2012
Windows Server 2008 r2
Windows 8
Windows 7
Windows Azure
![Page 10: SignalR](https://reader036.fdocuments.net/reader036/viewer/2022062708/558c1833d8b42ae8718b462b/html5/thumbnails/10.jpg)
Unterstützte IIS-Versionen IIS 8 or IIS 8 Express.
IIS 7 and 7.5 with support for extensionless URLs is required.
IIS must be running in integrated mode; classic mode is not supported. Message delays of up to 30 seconds may be experienced if IIS is run in classic mode using the Server-Sent Events transport.
The hosting application must be running in full trust mode.
![Page 11: SignalR](https://reader036.fdocuments.net/reader036/viewer/2022062708/558c1833d8b42ae8718b462b/html5/thumbnails/11.jpg)
Browser-Anforderungen
Transport Internet Explorer
Chrome(Windows or iOS)
Firefox Safari (OSX or iOS) Android
WebSockets 10+ current - 1 current - 1 current - 1 N/A
Server-Sent Events N/A current - 1 current - 1 current - 1 N/A
ForeverFrame 8+ N/A N/A N/A 4.1
Long Polling 8+ current - 1 current - 1 current - 1 4.1
Attention: jQuery version 1.6.4 or major later versions (such as 1.7.2, 1.8.2, or 1.9.1) required!
![Page 12: SignalR](https://reader036.fdocuments.net/reader036/viewer/2022062708/558c1833d8b42ae8718b462b/html5/thumbnails/12.jpg)
Desktop/Silverlight-Anforderungen
Transport .NET Application Silverlight
Web Sockets Windows 8+ and .NET 4.5+ N/A
Forever Frame N/A N/A
Server-Sent Events .NET 4+ 5+
Long Polling .NET 4+ 5+
![Page 13: SignalR](https://reader036.fdocuments.net/reader036/viewer/2022062708/558c1833d8b42ae8718b462b/html5/thumbnails/13.jpg)
Windows Store/Phone-Anforderungen
Transport Windows Store/ .NET
Windows Store/ JavaScript
Windows Phone/IE
Windows Phone/.NET
WebSockets N/A Win8+ 8+ N/A
Forever Frame N/A Win8+ 7.5+ N/A
Server-Sent Events Win8+ N/A N/A 8+
Long Polling Win8+ Win8+ 7.5+ 8+
![Page 14: SignalR](https://reader036.fdocuments.net/reader036/viewer/2022062708/558c1833d8b42ae8718b462b/html5/thumbnails/14.jpg)
Demo
![Page 15: SignalR](https://reader036.fdocuments.net/reader036/viewer/2022062708/558c1833d8b42ae8718b462b/html5/thumbnails/15.jpg)
Tracing
![Page 16: SignalR](https://reader036.fdocuments.net/reader036/viewer/2022062708/558c1833d8b42ae8718b462b/html5/thumbnails/16.jpg)
Tracing - NachrichtentypenSource Messages
SignalR.SqlMessageBus SQL Message Bus scaleout provider setup, database operation, error, and timeout events
SignalR.ServiceBusMessageBus Service bus scaleout provider topic creation and subscription, error, and messaging events
SignalR.RedisMessageBus Redis scaleout provider connection, disconnection, and error events
SignalR.ScaleoutMessageBus Scaleout messaging events
SignalR.Transports.WebSocketTransport WebSocket transport connection, disconnection, messaging, and error events
SignalR.Transports.ServerSentEventsTransport ServerSentEvents transport connection, disconnection, messaging, and error events
SignalR.Transports.ForeverFrameTransport ForeverFrame transport connection, disconnection, messaging, and error events
SignalR.Transports.LongPollingTransport LongPolling transport connection, disconnection, messaging, and error events
SignalR.Transports.TransportHeartBeat Transport connection, disconnection, and keepalive events
SignalR.ReflectedHubDescriptorProvider Hub discovery events
![Page 17: SignalR](https://reader036.fdocuments.net/reader036/viewer/2022062708/558c1833d8b42ae8718b462b/html5/thumbnails/17.jpg)
Demo
![Page 18: SignalR](https://reader036.fdocuments.net/reader036/viewer/2022062708/558c1833d8b42ae8718b462b/html5/thumbnails/18.jpg)
Tracing - Konfiguration- in Anwendungskonfigurationsdatei (app.config, web.config) für Server- im Client so
_connection.TraceLevel = TraceLevels.All; _connection.TraceWriter = Console.Out;
oder:
var writer = new StreamWriter("SignalRClient.log");writer.AutoFlush = true;
_connection.TraceLevel = TraceLevels.All; _connection.TraceWriter = writer;
![Page 19: SignalR](https://reader036.fdocuments.net/reader036/viewer/2022062708/558c1833d8b42ae8718b462b/html5/thumbnails/19.jpg)
Security
![Page 20: SignalR](https://reader036.fdocuments.net/reader036/viewer/2022062708/558c1833d8b42ae8718b462b/html5/thumbnails/20.jpg)
Security
- SignalR besitzt keinen eigenen Authentifizierungsmechanismus- unterliegt dem Anwendungs-Authentifizierungsmechanismus (z.B.
Forms Authentication, oAuth etc.)- stellt das Authorize-Attribut zur Verfügung
![Page 21: SignalR](https://reader036.fdocuments.net/reader036/viewer/2022062708/558c1833d8b42ae8718b462b/html5/thumbnails/21.jpg)
Quelle: Microsoft
![Page 22: SignalR](https://reader036.fdocuments.net/reader036/viewer/2022062708/558c1833d8b42ae8718b462b/html5/thumbnails/22.jpg)
Quelle: Microsoft
![Page 23: SignalR](https://reader036.fdocuments.net/reader036/viewer/2022062708/558c1833d8b42ae8718b462b/html5/thumbnails/23.jpg)
Security
- SignalR benutzt Connection Token in jedem Request- Connection Token besteht aus Connection Id und Username- Connection Token wir mit jedem Request verifiziert
Frage: Wie kommt SignalR zu einen Username?
![Page 24: SignalR](https://reader036.fdocuments.net/reader036/viewer/2022062708/558c1833d8b42ae8718b462b/html5/thumbnails/24.jpg)
Cookie-AuthentifizierungCookie cookie = AuthenticateUser(username, password);
var connection = new HubConnection(url); connection.CookieContainer = new CookieContainer(); connection.CookieContainer.Add(cookie); connection.Start().Wait();
private Cookie AuthenticateUser(object username, object password){ Cookie cookie = null; // Get Cookie from FormsAuthentication response. return cookie; }
![Page 25: SignalR](https://reader036.fdocuments.net/reader036/viewer/2022062708/558c1833d8b42ae8718b462b/html5/thumbnails/25.jpg)
Windows-Authentifizierung
var connection = new HubConnection(url);
connection.Credentials = CredentialCache.DefaultCredentials; connection.Start().Wait();
![Page 26: SignalR](https://reader036.fdocuments.net/reader036/viewer/2022062708/558c1833d8b42ae8718b462b/html5/thumbnails/26.jpg)
Header-Authentifizierung
var connection = new HubConnection(url);
connection.Headers.Add("myauthtoken", /* token data */); connection.Start().Wait();
![Page 27: SignalR](https://reader036.fdocuments.net/reader036/viewer/2022062708/558c1833d8b42ae8718b462b/html5/thumbnails/27.jpg)
Zertifikat-Authentifizierung
var connection = new HubConnection(url);
connection.AddClientCertificate( X509Certificate.CreateFromCertFile("MyCert.cer")); connection.Start().Wait();
![Page 28: SignalR](https://reader036.fdocuments.net/reader036/viewer/2022062708/558c1833d8b42ae8718b462b/html5/thumbnails/28.jpg)
Demo