SlideShare ist ein Scribd-Unternehmen logo
1 von 28
SELA DEVELOPER PRACTICE
May 5-9, 2013
Ran Wahle
Real time Web experience with signalR
Agenda
• “Real Time” web techniques
• What is signalR
• SignalR protocol
• Hubs
• Groups and private messages
• .Net client
• Self Hosting
• Scaleout
Real-time web
Polling
ForeverFrames
Long-Polling
ServerSentEvents
WebSocket
Polling
Long Polling
Server Sent Events
Forever Frames
Web Socket
Web Socket Request
TCP Socket
ServerClient
Web socket
• Actual TCP socket between server and client
• HTML5 standard
• Supported by Windows server 2012 / Windows 8
• Supported by IE10+, Chrome, Firefox, Opera and
more
Web socket in code
Server (C#):
public void ProcessRequest(HttpContext context)
{
HttpContext.Current.
AcceptWebSocketRequest
(new ChatWebSocketHandler());
context.Response.StatusCode
=(int)HttpStatusCode.SwitchingProtocols;
}
Client: (javascript)
var websocket = new window.WebSocket(“ws://<web socket url>”);
Web socket in code
Server (C#)
public class MyWebSocketHandler :
WebSocketHandler
public override void OnOpen()
public override void OnError()
public override void OnMessage(string
message)
Client (Javascript)
websocket.onopen = function () { …}
websocket.onerror = function(data) {…}
websocket.onmessage = function (event) {
WebSocket is not enough
• Not all servers support web sockets
• Not all network components support web sockets
• It’s API is limited
What do we need?
• Code once, deploy everywhere
• As cross-platform as possible
• Simple API to work with
What is signalR
• Open source project
• Abstraction layer over connection technique
• Can be self-hosted
• Call client methods from the server
ServerSentEvents
=
Polling
ForeverFrames
Long-Polling
WebSocket
So, why not WebSocket
WebSocket
• Good performance
• Strict prerequisites
• Limited API
SignalR
• Abstraction layer
• Rich API
• Supports WebSocket
Getting started
“Every time I see live-coding I get down on my knees
and pray”
Anonymous narrator
Protocol
Negotiate request
Negotiate response
Connection phase
Client
Server
Try it yourself
http://ranw.azurewebsites.net/chatpage.html
Hub
• Abstraction over signalR connection
• Service-like API
• Call clients methods from the server
Hub
Server (C#)
public void ServerMethod(args)
{
…..
}
private void SendToClient()
{
Clients.All.doSomething(args);
}
Client (Javascript)
hub.server.serverMethod(args);
hub.client.doSomething = function(args)
{
…
};
Private messages
• You can use connection ID
• You can access a particular client by it
Clients.Client(connectionId).sendMessage(message)
Groups
• Part of Hub API
• Stored on client
• Not persistent
Groups.Add(Context.ConnectionId, groupName);
Clients.Group(groupName).invokeSomeClientMethod(args…);
.Net client
_connection = new HubConnection(“Server Url");
IHubProxy proxy = connection.CreateHubProxy(“Hub Name");
_connection.Start().ContinueWith(
//define proxies
);
//invoke server methods
_proxy.Invoke(“HubServerMethod“ , args…));
Self hosting
• Three NuGet packages to install
Microsoft.Owin.Hosting
Microsoft.Owin.Host.HttpListener
Microsoft.AspNet.SignalR.Owin
• Create class with Configuration method.
• Map hub in the Configuration method
• Use the class as a type parameter to
WebApplication.Start
ScaleOut with Redis
• Install Redis for Linux or Clone the windows porting
• Add One line of code
GlobalHost.DependencyResolver.UseRedis(“<server>", <port>, “<password>", “<
storagekey>");
• On Windows – run redis from command line
• Your app is ready to scaleout
What have we seen today?
• Real time experience is more than just polling
• Using signalR can use the best available technique
• It can be self hosted
• It can scale out
• It has several clients
Other resources
•http://www.asp.net/signalr
•http://signalr.net/
•Twitters:@signalr @DamianEdwards @davidfowl
and @DavianFowlwards
•http://blogs.Microsoft.co.il/blogs/ranw
Thank You
Ran Wahle
ranw@sela.co.il
http://blogs.Microsoft.co.il/blogs/ranw

Weitere ähnliche Inhalte

Was ist angesagt?

WEB SOCKET 應用
WEB SOCKET 應用WEB SOCKET 應用
WEB SOCKET 應用Jerromy Lee
 
Altitude SF 2017: The power of the network
Altitude SF 2017: The power of the networkAltitude SF 2017: The power of the network
Altitude SF 2017: The power of the networkFastly
 
Websocket vs SSE - Paris.js - 24/06/15
Websocket vs SSE - Paris.js - 24/06/15Websocket vs SSE - Paris.js - 24/06/15
Websocket vs SSE - Paris.js - 24/06/15streamdata.io
 
Altitude SF 2017: Fastly GSLB: Scaling your microservice and multi-cloud envi...
Altitude SF 2017: Fastly GSLB: Scaling your microservice and multi-cloud envi...Altitude SF 2017: Fastly GSLB: Scaling your microservice and multi-cloud envi...
Altitude SF 2017: Fastly GSLB: Scaling your microservice and multi-cloud envi...Fastly
 
Codecamp iasi-26 nov 2011-web sockets
Codecamp iasi-26 nov 2011-web socketsCodecamp iasi-26 nov 2011-web sockets
Codecamp iasi-26 nov 2011-web socketsCodecamp Romania
 
4th Lecture: JSP and such
4th Lecture:  JSP and such4th Lecture:  JSP and such
4th Lecture: JSP and suchManolis Vavalis
 
Webinar slides "Building Real-Time Collaborative Web Applications"
Webinar slides "Building Real-Time Collaborative Web Applications"Webinar slides "Building Real-Time Collaborative Web Applications"
Webinar slides "Building Real-Time Collaborative Web Applications"Sachin Katariya
 
Cache control directive
Cache control directiveCache control directive
Cache control directiveMohamed Mamoon
 
Getting Started with Web Services
Getting Started with Web ServicesGetting Started with Web Services
Getting Started with Web ServicesDataNext Solutions
 
Serverless architecture: introduction & first steps
Serverless architecture: introduction & first stepsServerless architecture: introduction & first steps
Serverless architecture: introduction & first stepsThe Software House
 
Flask jwt authentication tutorial
Flask jwt authentication tutorialFlask jwt authentication tutorial
Flask jwt authentication tutorialKaty Slemon
 
Building a serverless company on AWS lambda and Serverless framework
Building a serverless company on AWS lambda and Serverless frameworkBuilding a serverless company on AWS lambda and Serverless framework
Building a serverless company on AWS lambda and Serverless frameworkLuciano Mammino
 
DevOps in the era of serverless computing - Alessandro Vozza - Codemotion Ams...
DevOps in the era of serverless computing - Alessandro Vozza - Codemotion Ams...DevOps in the era of serverless computing - Alessandro Vozza - Codemotion Ams...
DevOps in the era of serverless computing - Alessandro Vozza - Codemotion Ams...Codemotion
 
Developing a user-friendly OpenResty application
Developing a user-friendly OpenResty applicationDeveloping a user-friendly OpenResty application
Developing a user-friendly OpenResty applicationThibault Charbonnier
 
Consul First Steps
Consul First StepsConsul First Steps
Consul First StepsMarc Cluet
 

Was ist angesagt? (20)

web3j 1.0 update
web3j 1.0 updateweb3j 1.0 update
web3j 1.0 update
 
Introduce warden
Introduce wardenIntroduce warden
Introduce warden
 
WEB SOCKET 應用
WEB SOCKET 應用WEB SOCKET 應用
WEB SOCKET 應用
 
Altitude SF 2017: The power of the network
Altitude SF 2017: The power of the networkAltitude SF 2017: The power of the network
Altitude SF 2017: The power of the network
 
Websocket vs SSE - Paris.js - 24/06/15
Websocket vs SSE - Paris.js - 24/06/15Websocket vs SSE - Paris.js - 24/06/15
Websocket vs SSE - Paris.js - 24/06/15
 
Altitude SF 2017: Fastly GSLB: Scaling your microservice and multi-cloud envi...
Altitude SF 2017: Fastly GSLB: Scaling your microservice and multi-cloud envi...Altitude SF 2017: Fastly GSLB: Scaling your microservice and multi-cloud envi...
Altitude SF 2017: Fastly GSLB: Scaling your microservice and multi-cloud envi...
 
Codecamp iasi-26 nov 2011-web sockets
Codecamp iasi-26 nov 2011-web socketsCodecamp iasi-26 nov 2011-web sockets
Codecamp iasi-26 nov 2011-web sockets
 
4th Lecture: JSP and such
4th Lecture:  JSP and such4th Lecture:  JSP and such
4th Lecture: JSP and such
 
Webinar slides "Building Real-Time Collaborative Web Applications"
Webinar slides "Building Real-Time Collaborative Web Applications"Webinar slides "Building Real-Time Collaborative Web Applications"
Webinar slides "Building Real-Time Collaborative Web Applications"
 
Wcf remaining
Wcf remainingWcf remaining
Wcf remaining
 
Cache control directive
Cache control directiveCache control directive
Cache control directive
 
Getting Started with Web Services
Getting Started with Web ServicesGetting Started with Web Services
Getting Started with Web Services
 
Serverless architecture: introduction & first steps
Serverless architecture: introduction & first stepsServerless architecture: introduction & first steps
Serverless architecture: introduction & first steps
 
Flask jwt authentication tutorial
Flask jwt authentication tutorialFlask jwt authentication tutorial
Flask jwt authentication tutorial
 
Building a serverless company on AWS lambda and Serverless framework
Building a serverless company on AWS lambda and Serverless frameworkBuilding a serverless company on AWS lambda and Serverless framework
Building a serverless company on AWS lambda and Serverless framework
 
Consul in 5 minutes
Consul in 5 minutesConsul in 5 minutes
Consul in 5 minutes
 
DevOps in the era of serverless computing - Alessandro Vozza - Codemotion Ams...
DevOps in the era of serverless computing - Alessandro Vozza - Codemotion Ams...DevOps in the era of serverless computing - Alessandro Vozza - Codemotion Ams...
DevOps in the era of serverless computing - Alessandro Vozza - Codemotion Ams...
 
Developing a user-friendly OpenResty application
Developing a user-friendly OpenResty applicationDeveloping a user-friendly OpenResty application
Developing a user-friendly OpenResty application
 
Server architecture
Server architectureServer architecture
Server architecture
 
Consul First Steps
Consul First StepsConsul First Steps
Consul First Steps
 

Andere mochten auch

Working With Annotations
Working With AnnotationsWorking With Annotations
Working With AnnotationsSheldon Jessup
 
DEV301- Web Service Programming with WCF 3.5
DEV301- Web Service Programming with WCF 3.5DEV301- Web Service Programming with WCF 3.5
DEV301- Web Service Programming with WCF 3.5Eyal Vardi
 
Brian Mork - DC214 October 2015 - ECB Sucks
Brian Mork - DC214 October 2015 - ECB SucksBrian Mork - DC214 October 2015 - ECB Sucks
Brian Mork - DC214 October 2015 - ECB SucksNothing Nowhere
 
Nano fillers
Nano fillersNano fillers
Nano fillersspartun
 
Getting started with typescript and angular 2
Getting started with typescript  and angular 2Getting started with typescript  and angular 2
Getting started with typescript and angular 2Knoldus Inc.
 
Transport layer services
Transport layer servicesTransport layer services
Transport layer servicesMelvin Cabatuan
 
The teaching of edukasyon sa pagpapakatao
The teaching of edukasyon sa pagpapakataoThe teaching of edukasyon sa pagpapakatao
The teaching of edukasyon sa pagpapakataocarren may manalo
 

Andere mochten auch (14)

Working With Annotations
Working With AnnotationsWorking With Annotations
Working With Annotations
 
Mobile testing
Mobile testingMobile testing
Mobile testing
 
siddharth trailblazer 2011
siddharth trailblazer 2011siddharth trailblazer 2011
siddharth trailblazer 2011
 
Reviews
ReviewsReviews
Reviews
 
DEV301- Web Service Programming with WCF 3.5
DEV301- Web Service Programming with WCF 3.5DEV301- Web Service Programming with WCF 3.5
DEV301- Web Service Programming with WCF 3.5
 
Brian Mork - DC214 October 2015 - ECB Sucks
Brian Mork - DC214 October 2015 - ECB SucksBrian Mork - DC214 October 2015 - ECB Sucks
Brian Mork - DC214 October 2015 - ECB Sucks
 
earthquake
earthquake earthquake
earthquake
 
Nano fillers
Nano fillersNano fillers
Nano fillers
 
Java Script ppt
Java Script pptJava Script ppt
Java Script ppt
 
Handoutmodyul11
Handoutmodyul11Handoutmodyul11
Handoutmodyul11
 
Getting started with typescript and angular 2
Getting started with typescript  and angular 2Getting started with typescript  and angular 2
Getting started with typescript and angular 2
 
Steganography
SteganographySteganography
Steganography
 
Transport layer services
Transport layer servicesTransport layer services
Transport layer services
 
The teaching of edukasyon sa pagpapakatao
The teaching of edukasyon sa pagpapakataoThe teaching of edukasyon sa pagpapakatao
The teaching of edukasyon sa pagpapakatao
 

Ähnlich wie Realtime web experience with signal r

Building Real Time Applications with ASP.NET SignalR 2.0 by Rachel Appel
Building Real Time Applications with ASP.NET SignalR 2.0 by Rachel AppelBuilding Real Time Applications with ASP.NET SignalR 2.0 by Rachel Appel
Building Real Time Applications with ASP.NET SignalR 2.0 by Rachel Appel.NET Conf UY
 
ASP.NET MVC 5 and SignalR 2
ASP.NET MVC 5 and SignalR 2ASP.NET MVC 5 and SignalR 2
ASP.NET MVC 5 and SignalR 2Jaliya Udagedara
 
Real time Communication with Signalr (Android Client)
Real time Communication with Signalr (Android Client)Real time Communication with Signalr (Android Client)
Real time Communication with Signalr (Android Client)Deepak Gupta
 
Realtime web experience with signalR
Realtime web experience with signalRRealtime web experience with signalR
Realtime web experience with signalRRan Wahle
 
DDD Melbourne 2014 security in ASP.Net Web API 2
DDD Melbourne 2014 security in ASP.Net Web API 2DDD Melbourne 2014 security in ASP.Net Web API 2
DDD Melbourne 2014 security in ASP.Net Web API 2Pratik Khasnabis
 
Groovy & Grails eXchange 2012 vert.x presentation
Groovy & Grails eXchange 2012 vert.x presentationGroovy & Grails eXchange 2012 vert.x presentation
Groovy & Grails eXchange 2012 vert.x presentationStuart (Pid) Williams
 
Building Real time Application with Azure SignalR Service
Building Real time Application with Azure SignalR ServiceBuilding Real time Application with Azure SignalR Service
Building Real time Application with Azure SignalR ServiceJalpesh Vadgama
 
Using communication and messaging API in the HTML5 world - GIl Fink, sparXsys
Using communication and messaging API in the HTML5 world - GIl Fink, sparXsysUsing communication and messaging API in the HTML5 world - GIl Fink, sparXsys
Using communication and messaging API in the HTML5 world - GIl Fink, sparXsysCodemotion Tel Aviv
 
ASP.NET Core 3.0 Deep Dive
ASP.NET Core 3.0 Deep DiveASP.NET Core 3.0 Deep Dive
ASP.NET Core 3.0 Deep DiveJon Galloway
 
Realtime Messaging und verteilte Systeme mit SharePoint und Windows Azure Ser...
Realtime Messaging und verteilte Systeme mit SharePoint und Windows Azure Ser...Realtime Messaging und verteilte Systeme mit SharePoint und Windows Azure Ser...
Realtime Messaging und verteilte Systeme mit SharePoint und Windows Azure Ser...Damir Dobric
 
Asynchronous Web Programming with HTML5 WebSockets and Java
Asynchronous Web Programming with HTML5 WebSockets and JavaAsynchronous Web Programming with HTML5 WebSockets and Java
Asynchronous Web Programming with HTML5 WebSockets and JavaJames Falkner
 
Node.JS and WebSockets with Faye
Node.JS and WebSockets with FayeNode.JS and WebSockets with Faye
Node.JS and WebSockets with FayeMatjaž Lipuš
 
Getting started with ASPNET Core SignalR
Getting started with ASPNET Core SignalRGetting started with ASPNET Core SignalR
Getting started with ASPNET Core SignalRNemi Chand
 

Ähnlich wie Realtime web experience with signal r (20)

Building Real Time Applications with ASP.NET SignalR 2.0 by Rachel Appel
Building Real Time Applications with ASP.NET SignalR 2.0 by Rachel AppelBuilding Real Time Applications with ASP.NET SignalR 2.0 by Rachel Appel
Building Real Time Applications with ASP.NET SignalR 2.0 by Rachel Appel
 
ASP.NET MVC 5 and SignalR 2
ASP.NET MVC 5 and SignalR 2ASP.NET MVC 5 and SignalR 2
ASP.NET MVC 5 and SignalR 2
 
Introduction to SignalR
Introduction to SignalRIntroduction to SignalR
Introduction to SignalR
 
Real time Communication with Signalr (Android Client)
Real time Communication with Signalr (Android Client)Real time Communication with Signalr (Android Client)
Real time Communication with Signalr (Android Client)
 
signalr
signalrsignalr
signalr
 
Realtime web experience with signalR
Realtime web experience with signalRRealtime web experience with signalR
Realtime web experience with signalR
 
WebSocket
WebSocketWebSocket
WebSocket
 
DDD Melbourne 2014 security in ASP.Net Web API 2
DDD Melbourne 2014 security in ASP.Net Web API 2DDD Melbourne 2014 security in ASP.Net Web API 2
DDD Melbourne 2014 security in ASP.Net Web API 2
 
Real-time ASP.NET with SignalR
Real-time ASP.NET with SignalRReal-time ASP.NET with SignalR
Real-time ASP.NET with SignalR
 
Groovy & Grails eXchange 2012 vert.x presentation
Groovy & Grails eXchange 2012 vert.x presentationGroovy & Grails eXchange 2012 vert.x presentation
Groovy & Grails eXchange 2012 vert.x presentation
 
Building Real time Application with Azure SignalR Service
Building Real time Application with Azure SignalR ServiceBuilding Real time Application with Azure SignalR Service
Building Real time Application with Azure SignalR Service
 
Windows 8 Apps and the Outside World
Windows 8 Apps and the Outside WorldWindows 8 Apps and the Outside World
Windows 8 Apps and the Outside World
 
Real time web apps
Real time web appsReal time web apps
Real time web apps
 
www.ppt
www.pptwww.ppt
www.ppt
 
Using communication and messaging API in the HTML5 world - GIl Fink, sparXsys
Using communication and messaging API in the HTML5 world - GIl Fink, sparXsysUsing communication and messaging API in the HTML5 world - GIl Fink, sparXsys
Using communication and messaging API in the HTML5 world - GIl Fink, sparXsys
 
ASP.NET Core 3.0 Deep Dive
ASP.NET Core 3.0 Deep DiveASP.NET Core 3.0 Deep Dive
ASP.NET Core 3.0 Deep Dive
 
Realtime Messaging und verteilte Systeme mit SharePoint und Windows Azure Ser...
Realtime Messaging und verteilte Systeme mit SharePoint und Windows Azure Ser...Realtime Messaging und verteilte Systeme mit SharePoint und Windows Azure Ser...
Realtime Messaging und verteilte Systeme mit SharePoint und Windows Azure Ser...
 
Asynchronous Web Programming with HTML5 WebSockets and Java
Asynchronous Web Programming with HTML5 WebSockets and JavaAsynchronous Web Programming with HTML5 WebSockets and Java
Asynchronous Web Programming with HTML5 WebSockets and Java
 
Node.JS and WebSockets with Faye
Node.JS and WebSockets with FayeNode.JS and WebSockets with Faye
Node.JS and WebSockets with Faye
 
Getting started with ASPNET Core SignalR
Getting started with ASPNET Core SignalRGetting started with ASPNET Core SignalR
Getting started with ASPNET Core SignalR
 

Mehr von Ran Wahle

MicroFrontend With Iframes, dirty laundry that can be cleaned
MicroFrontend With Iframes, dirty laundry that can be cleanedMicroFrontend With Iframes, dirty laundry that can be cleaned
MicroFrontend With Iframes, dirty laundry that can be cleanedRan Wahle
 
Into React-DOM.pptx
Into React-DOM.pptxInto React-DOM.pptx
Into React-DOM.pptxRan Wahle
 
Lets go to the background
Lets go to the backgroundLets go to the background
Lets go to the backgroundRan Wahle
 
Permissions api
Permissions apiPermissions api
Permissions apiRan Wahle
 
Lets go vanilla
Lets go vanillaLets go vanilla
Lets go vanillaRan Wahle
 
Custom elements
Custom elements Custom elements
Custom elements Ran Wahle
 
Web workers
Web workers Web workers
Web workers Ran Wahle
 
Using legacy code with micro frontends
Using legacy code with micro frontendsUsing legacy code with micro frontends
Using legacy code with micro frontendsRan Wahle
 
Ngrx one-effect
Ngrx one-effectNgrx one-effect
Ngrx one-effectRan Wahle
 
Angular migration
Angular migrationAngular migration
Angular migrationRan Wahle
 
Javascript async / await Frontend-IL
Javascript async / await Frontend-ILJavascript async / await Frontend-IL
Javascript async / await Frontend-ILRan Wahle
 
Boost js state management
Boost js state managementBoost js state management
Boost js state managementRan Wahle
 
Angular 2.0 change detection
Angular 2.0 change detectionAngular 2.0 change detection
Angular 2.0 change detectionRan Wahle
 
Code migration from Angular 1.x to Angular 2.0
Code migration from Angular 1.x to Angular 2.0Code migration from Angular 1.x to Angular 2.0
Code migration from Angular 1.x to Angular 2.0Ran Wahle
 
Async patterns in javascript
Async patterns in javascriptAsync patterns in javascript
Async patterns in javascriptRan Wahle
 
Angular js 2
Angular js 2Angular js 2
Angular js 2Ran Wahle
 
Asyncawait in typescript
Asyncawait in typescriptAsyncawait in typescript
Asyncawait in typescriptRan Wahle
 
Angular%201%20to%20angular%202
Angular%201%20to%20angular%202Angular%201%20to%20angular%202
Angular%201%20to%20angular%202Ran Wahle
 
What’s new in angular 2 - From FrontEnd IL Meetup
What’s new in angular 2 - From FrontEnd IL MeetupWhat’s new in angular 2 - From FrontEnd IL Meetup
What’s new in angular 2 - From FrontEnd IL MeetupRan Wahle
 
angularJs Workshop
angularJs WorkshopangularJs Workshop
angularJs WorkshopRan Wahle
 

Mehr von Ran Wahle (20)

MicroFrontend With Iframes, dirty laundry that can be cleaned
MicroFrontend With Iframes, dirty laundry that can be cleanedMicroFrontend With Iframes, dirty laundry that can be cleaned
MicroFrontend With Iframes, dirty laundry that can be cleaned
 
Into React-DOM.pptx
Into React-DOM.pptxInto React-DOM.pptx
Into React-DOM.pptx
 
Lets go to the background
Lets go to the backgroundLets go to the background
Lets go to the background
 
Permissions api
Permissions apiPermissions api
Permissions api
 
Lets go vanilla
Lets go vanillaLets go vanilla
Lets go vanilla
 
Custom elements
Custom elements Custom elements
Custom elements
 
Web workers
Web workers Web workers
Web workers
 
Using legacy code with micro frontends
Using legacy code with micro frontendsUsing legacy code with micro frontends
Using legacy code with micro frontends
 
Ngrx one-effect
Ngrx one-effectNgrx one-effect
Ngrx one-effect
 
Angular migration
Angular migrationAngular migration
Angular migration
 
Javascript async / await Frontend-IL
Javascript async / await Frontend-ILJavascript async / await Frontend-IL
Javascript async / await Frontend-IL
 
Boost js state management
Boost js state managementBoost js state management
Boost js state management
 
Angular 2.0 change detection
Angular 2.0 change detectionAngular 2.0 change detection
Angular 2.0 change detection
 
Code migration from Angular 1.x to Angular 2.0
Code migration from Angular 1.x to Angular 2.0Code migration from Angular 1.x to Angular 2.0
Code migration from Angular 1.x to Angular 2.0
 
Async patterns in javascript
Async patterns in javascriptAsync patterns in javascript
Async patterns in javascript
 
Angular js 2
Angular js 2Angular js 2
Angular js 2
 
Asyncawait in typescript
Asyncawait in typescriptAsyncawait in typescript
Asyncawait in typescript
 
Angular%201%20to%20angular%202
Angular%201%20to%20angular%202Angular%201%20to%20angular%202
Angular%201%20to%20angular%202
 
What’s new in angular 2 - From FrontEnd IL Meetup
What’s new in angular 2 - From FrontEnd IL MeetupWhat’s new in angular 2 - From FrontEnd IL Meetup
What’s new in angular 2 - From FrontEnd IL Meetup
 
angularJs Workshop
angularJs WorkshopangularJs Workshop
angularJs Workshop
 

Kürzlich hochgeladen

Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024The Digital Insurer
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUK Journal
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century educationjfdjdjcjdnsjd
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?Antenna Manufacturer Coco
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 

Kürzlich hochgeladen (20)

Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 

Realtime web experience with signal r

  • 1. SELA DEVELOPER PRACTICE May 5-9, 2013 Ran Wahle Real time Web experience with signalR
  • 2. Agenda • “Real Time” web techniques • What is signalR • SignalR protocol • Hubs • Groups and private messages • .Net client • Self Hosting • Scaleout
  • 8. Web Socket Web Socket Request TCP Socket ServerClient
  • 9. Web socket • Actual TCP socket between server and client • HTML5 standard • Supported by Windows server 2012 / Windows 8 • Supported by IE10+, Chrome, Firefox, Opera and more
  • 10. Web socket in code Server (C#): public void ProcessRequest(HttpContext context) { HttpContext.Current. AcceptWebSocketRequest (new ChatWebSocketHandler()); context.Response.StatusCode =(int)HttpStatusCode.SwitchingProtocols; } Client: (javascript) var websocket = new window.WebSocket(“ws://<web socket url>”);
  • 11. Web socket in code Server (C#) public class MyWebSocketHandler : WebSocketHandler public override void OnOpen() public override void OnError() public override void OnMessage(string message) Client (Javascript) websocket.onopen = function () { …} websocket.onerror = function(data) {…} websocket.onmessage = function (event) {
  • 12. WebSocket is not enough • Not all servers support web sockets • Not all network components support web sockets • It’s API is limited
  • 13. What do we need? • Code once, deploy everywhere • As cross-platform as possible • Simple API to work with
  • 14. What is signalR • Open source project • Abstraction layer over connection technique • Can be self-hosted • Call client methods from the server ServerSentEvents = Polling ForeverFrames Long-Polling WebSocket
  • 15. So, why not WebSocket WebSocket • Good performance • Strict prerequisites • Limited API SignalR • Abstraction layer • Rich API • Supports WebSocket
  • 16. Getting started “Every time I see live-coding I get down on my knees and pray” Anonymous narrator
  • 19. Hub • Abstraction over signalR connection • Service-like API • Call clients methods from the server
  • 20. Hub Server (C#) public void ServerMethod(args) { ….. } private void SendToClient() { Clients.All.doSomething(args); } Client (Javascript) hub.server.serverMethod(args); hub.client.doSomething = function(args) { … };
  • 21. Private messages • You can use connection ID • You can access a particular client by it Clients.Client(connectionId).sendMessage(message)
  • 22. Groups • Part of Hub API • Stored on client • Not persistent Groups.Add(Context.ConnectionId, groupName); Clients.Group(groupName).invokeSomeClientMethod(args…);
  • 23. .Net client _connection = new HubConnection(“Server Url"); IHubProxy proxy = connection.CreateHubProxy(“Hub Name"); _connection.Start().ContinueWith( //define proxies ); //invoke server methods _proxy.Invoke(“HubServerMethod“ , args…));
  • 24. Self hosting • Three NuGet packages to install Microsoft.Owin.Hosting Microsoft.Owin.Host.HttpListener Microsoft.AspNet.SignalR.Owin • Create class with Configuration method. • Map hub in the Configuration method • Use the class as a type parameter to WebApplication.Start
  • 25. ScaleOut with Redis • Install Redis for Linux or Clone the windows porting • Add One line of code GlobalHost.DependencyResolver.UseRedis(“<server>", <port>, “<password>", “< storagekey>"); • On Windows – run redis from command line • Your app is ready to scaleout
  • 26. What have we seen today? • Real time experience is more than just polling • Using signalR can use the best available technique • It can be self hosted • It can scale out • It has several clients
  • 27. Other resources •http://www.asp.net/signalr •http://signalr.net/ •Twitters:@signalr @DamianEdwards @davidfowl and @DavianFowlwards •http://blogs.Microsoft.co.il/blogs/ranw