SlideShare a Scribd company logo
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

More Related Content

What's hot (20)

PDF
web3j 1.0 update
Conor Svensson
 
PDF
Introduce warden
Hieu Nguyen Trung
 
PDF
WEB SOCKET 應用
Jerromy Lee
 
PDF
Altitude SF 2017: The power of the network
Fastly
 
PPTX
Websocket vs SSE - Paris.js - 24/06/15
streamdata.io
 
PPTX
Altitude SF 2017: Fastly GSLB: Scaling your microservice and multi-cloud envi...
Fastly
 
PPTX
Codecamp iasi-26 nov 2011-web sockets
Codecamp Romania
 
PPTX
4th Lecture: JSP and such
Manolis Vavalis
 
PPTX
Webinar slides "Building Real-Time Collaborative Web Applications"
Sachin Katariya
 
PDF
Wcf remaining
shamsher ali
 
PPTX
Cache control directive
Mohamed Mamoon
 
PPTX
Getting Started with Web Services
DataNext Solutions
 
PDF
Serverless architecture: introduction & first steps
The Software House
 
PDF
Flask jwt authentication tutorial
Katy Slemon
 
PDF
Building a serverless company on AWS lambda and Serverless framework
Luciano Mammino
 
PDF
Consul in 5 minutes
Christophe Marchal
 
PDF
DevOps in the era of serverless computing - Alessandro Vozza - Codemotion Ams...
Codemotion
 
PDF
Developing a user-friendly OpenResty application
Thibault Charbonnier
 
PPTX
Server architecture
Masters Academy
 
PDF
Consul First Steps
Marc Cluet
 
web3j 1.0 update
Conor Svensson
 
Introduce warden
Hieu Nguyen Trung
 
WEB SOCKET 應用
Jerromy Lee
 
Altitude SF 2017: The power of the network
Fastly
 
Websocket vs SSE - Paris.js - 24/06/15
streamdata.io
 
Altitude SF 2017: Fastly GSLB: Scaling your microservice and multi-cloud envi...
Fastly
 
Codecamp iasi-26 nov 2011-web sockets
Codecamp Romania
 
4th Lecture: JSP and such
Manolis Vavalis
 
Webinar slides "Building Real-Time Collaborative Web Applications"
Sachin Katariya
 
Wcf remaining
shamsher ali
 
Cache control directive
Mohamed Mamoon
 
Getting Started with Web Services
DataNext Solutions
 
Serverless architecture: introduction & first steps
The Software House
 
Flask jwt authentication tutorial
Katy Slemon
 
Building a serverless company on AWS lambda and Serverless framework
Luciano Mammino
 
Consul in 5 minutes
Christophe Marchal
 
DevOps in the era of serverless computing - Alessandro Vozza - Codemotion Ams...
Codemotion
 
Developing a user-friendly OpenResty application
Thibault Charbonnier
 
Server architecture
Masters Academy
 
Consul First Steps
Marc Cluet
 

Viewers also liked (14)

PDF
Working With Annotations
Sheldon Jessup
 
PPT
Mobile testing
Hrushikesh Wakhle
 
PPT
siddharth trailblazer 2011
Siddharth Vikram Singh
 
DOCX
Reviews
Matthew Pisani
 
PPT
DEV301- Web Service Programming with WCF 3.5
Eyal Vardi
 
PDF
Brian Mork - DC214 October 2015 - ECB Sucks
Nothing Nowhere
 
PPTX
earthquake
Sriram Mukka
 
PPT
Nano fillers
spartun
 
PPT
Java Script ppt
Priya Goyal
 
DOCX
Handoutmodyul11
Juriz de Mesa
 
ODP
Getting started with typescript and angular 2
Knoldus Inc.
 
PDF
Transport layer services
Melvin Cabatuan
 
PPT
The teaching of edukasyon sa pagpapakatao
carren may manalo
 
Working With Annotations
Sheldon Jessup
 
Mobile testing
Hrushikesh Wakhle
 
siddharth trailblazer 2011
Siddharth Vikram Singh
 
DEV301- Web Service Programming with WCF 3.5
Eyal Vardi
 
Brian Mork - DC214 October 2015 - ECB Sucks
Nothing Nowhere
 
earthquake
Sriram Mukka
 
Nano fillers
spartun
 
Java Script ppt
Priya Goyal
 
Handoutmodyul11
Juriz de Mesa
 
Getting started with typescript and angular 2
Knoldus Inc.
 
Transport layer services
Melvin Cabatuan
 
The teaching of edukasyon sa pagpapakatao
carren may manalo
 
Ad

Similar to Realtime web experience with signal r (20)

PPTX
Realtime web open house
Ran Wahle
 
PPTX
Realtime web experience with signalR
Ran Wahle
 
PPTX
signalr
Owen Chen
 
PPTX
Signal r
Vasilios Kuznos
 
PPTX
ASP.NET MVC 5 and SignalR 2
Jaliya Udagedara
 
PPTX
Real-time ASP.NET with SignalR
Alexander Konduforov
 
PPTX
Real time Communication with Signalr (Android Client)
Deepak Gupta
 
PPTX
SignalR Dublin ALT.NET
Dorin Manoli
 
PPTX
SignalR with asp.net
Martin Bodocky
 
PPTX
Building Real time Application with Azure SignalR Service
Jalpesh Vadgama
 
PPTX
Building Real Time Applications with ASP.NET SignalR 2.0 by Rachel Appel
.NET Conf UY
 
PDF
An In-Depth Comparison of WebSocket and SignalR: Pros, Cons, and Use Cases
Tien Nguyen
 
PPTX
SignalR Overview
Michael Sukachev
 
PPTX
SignalR
LearningTech
 
PPTX
Training Webinar: Enterprise application performance with server push technol...
OutSystems
 
PPTX
Real-Time Communication
ssusere19c741
 
PDF
Introduction to SignalR
University of Hawai‘i at Mānoa
 
PDF
SignalR: Add real-time to your applications
Eugene Zharkov
 
PPSX
SignalR With ASP.Net part1
Esraa Ammar
 
PPTX
Real-time web applications using SharePoint, SignalR and Azure Service Bus
Dinusha Kumarasiri
 
Realtime web open house
Ran Wahle
 
Realtime web experience with signalR
Ran Wahle
 
signalr
Owen Chen
 
Signal r
Vasilios Kuznos
 
ASP.NET MVC 5 and SignalR 2
Jaliya Udagedara
 
Real-time ASP.NET with SignalR
Alexander Konduforov
 
Real time Communication with Signalr (Android Client)
Deepak Gupta
 
SignalR Dublin ALT.NET
Dorin Manoli
 
SignalR with asp.net
Martin Bodocky
 
Building Real time Application with Azure SignalR Service
Jalpesh Vadgama
 
Building Real Time Applications with ASP.NET SignalR 2.0 by Rachel Appel
.NET Conf UY
 
An In-Depth Comparison of WebSocket and SignalR: Pros, Cons, and Use Cases
Tien Nguyen
 
SignalR Overview
Michael Sukachev
 
SignalR
LearningTech
 
Training Webinar: Enterprise application performance with server push technol...
OutSystems
 
Real-Time Communication
ssusere19c741
 
Introduction to SignalR
University of Hawai‘i at Mānoa
 
SignalR: Add real-time to your applications
Eugene Zharkov
 
SignalR With ASP.Net part1
Esraa Ammar
 
Real-time web applications using SharePoint, SignalR and Azure Service Bus
Dinusha Kumarasiri
 
Ad

More from Ran Wahle (20)

PPTX
Implementing promises with typescripts, step by step
Ran Wahle
 
PPTX
HTML dialog element demonstration session
Ran Wahle
 
PPTX
MicroFrontend With Iframes, dirty laundry that can be cleaned
Ran Wahle
 
PPTX
Into React-DOM.pptx
Ran Wahle
 
PPTX
Lets go to the background
Ran Wahle
 
PPTX
Permissions api
Ran Wahle
 
PPTX
Lets go vanilla
Ran Wahle
 
PPTX
Custom elements
Ran Wahle
 
PPTX
Web workers
Ran Wahle
 
PPTX
Using legacy code with micro frontends
Ran Wahle
 
PPTX
Ngrx one-effect
Ran Wahle
 
PPTX
Angular migration
Ran Wahle
 
PPTX
Javascript async / await Frontend-IL
Ran Wahle
 
PPTX
Boost js state management
Ran Wahle
 
PPTX
Angular 2.0 change detection
Ran Wahle
 
PPTX
Code migration from Angular 1.x to Angular 2.0
Ran Wahle
 
PPTX
Async patterns in javascript
Ran Wahle
 
PPTX
Angular js 2
Ran Wahle
 
PPTX
Asyncawait in typescript
Ran Wahle
 
PPTX
Angular%201%20to%20angular%202
Ran Wahle
 
Implementing promises with typescripts, step by step
Ran Wahle
 
HTML dialog element demonstration session
Ran Wahle
 
MicroFrontend With Iframes, dirty laundry that can be cleaned
Ran Wahle
 
Into React-DOM.pptx
Ran Wahle
 
Lets go to the background
Ran Wahle
 
Permissions api
Ran Wahle
 
Lets go vanilla
Ran Wahle
 
Custom elements
Ran Wahle
 
Web workers
Ran Wahle
 
Using legacy code with micro frontends
Ran Wahle
 
Ngrx one-effect
Ran Wahle
 
Angular migration
Ran Wahle
 
Javascript async / await Frontend-IL
Ran Wahle
 
Boost js state management
Ran Wahle
 
Angular 2.0 change detection
Ran Wahle
 
Code migration from Angular 1.x to Angular 2.0
Ran Wahle
 
Async patterns in javascript
Ran Wahle
 
Angular js 2
Ran Wahle
 
Asyncawait in typescript
Ran Wahle
 
Angular%201%20to%20angular%202
Ran Wahle
 

Recently uploaded (20)

PPTX
UserCon Belgium: Honey, VMware increased my bill
stijn40
 
PDF
“Scaling i.MX Applications Processors’ Native Edge AI with Discrete AI Accele...
Edge AI and Vision Alliance
 
PDF
Quantum AI Discoveries: Fractal Patterns Consciousness and Cyclical Universes
Saikat Basu
 
PPTX
MARTSIA: A Tool for Confidential Data Exchange via Public Blockchain - Pitch ...
Michele Kryston
 
PPSX
Usergroup - OutSystems Architecture.ppsx
Kurt Vandevelde
 
PPTX
01_Approach Cyber- DORA Incident Management.pptx
FinTech Belgium
 
PPTX
New ThousandEyes Product Innovations: Cisco Live June 2025
ThousandEyes
 
PPTX
Smarter Governance with AI: What Every Board Needs to Know
OnBoard
 
PDF
LLM Search Readiness Audit - Dentsu x SEO Square - June 2025.pdf
Nick Samuel
 
PDF
How to Visualize the ​Spatio-Temporal Data Using CesiumJS​
SANGHEE SHIN
 
PDF
Darley - FIRST Copenhagen Lightning Talk (2025-06-26) Epochalypse 2038 - Time...
treyka
 
PDF
From Chatbot to Destroyer of Endpoints - Can ChatGPT Automate EDR Bypasses (1...
Priyanka Aash
 
PDF
Unlocking FME Flow’s Potential: Architecture Design for Modern Enterprises
Safe Software
 
DOCX
Daily Lesson Log MATATAG ICT TEchnology 8
LOIDAALMAZAN3
 
PDF
FME as an Orchestration Tool with Principles From Data Gravity
Safe Software
 
PDF
Automating the Geo-Referencing of Historic Aerial Photography in Flanders
Safe Software
 
PDF
Kubernetes - Architecture & Components.pdf
geethak285
 
PDF
Why aren't you using FME Flow's CPU Time?
Safe Software
 
PDF
Cracking the Code - Unveiling Synergies Between Open Source Security and AI.pdf
Priyanka Aash
 
PDF
Redefining Work in the Age of AI - What to expect? How to prepare? Why it mat...
Malinda Kapuruge
 
UserCon Belgium: Honey, VMware increased my bill
stijn40
 
“Scaling i.MX Applications Processors’ Native Edge AI with Discrete AI Accele...
Edge AI and Vision Alliance
 
Quantum AI Discoveries: Fractal Patterns Consciousness and Cyclical Universes
Saikat Basu
 
MARTSIA: A Tool for Confidential Data Exchange via Public Blockchain - Pitch ...
Michele Kryston
 
Usergroup - OutSystems Architecture.ppsx
Kurt Vandevelde
 
01_Approach Cyber- DORA Incident Management.pptx
FinTech Belgium
 
New ThousandEyes Product Innovations: Cisco Live June 2025
ThousandEyes
 
Smarter Governance with AI: What Every Board Needs to Know
OnBoard
 
LLM Search Readiness Audit - Dentsu x SEO Square - June 2025.pdf
Nick Samuel
 
How to Visualize the ​Spatio-Temporal Data Using CesiumJS​
SANGHEE SHIN
 
Darley - FIRST Copenhagen Lightning Talk (2025-06-26) Epochalypse 2038 - Time...
treyka
 
From Chatbot to Destroyer of Endpoints - Can ChatGPT Automate EDR Bypasses (1...
Priyanka Aash
 
Unlocking FME Flow’s Potential: Architecture Design for Modern Enterprises
Safe Software
 
Daily Lesson Log MATATAG ICT TEchnology 8
LOIDAALMAZAN3
 
FME as an Orchestration Tool with Principles From Data Gravity
Safe Software
 
Automating the Geo-Referencing of Historic Aerial Photography in Flanders
Safe Software
 
Kubernetes - Architecture & Components.pdf
geethak285
 
Why aren't you using FME Flow's CPU Time?
Safe Software
 
Cracking the Code - Unveiling Synergies Between Open Source Security and AI.pdf
Priyanka Aash
 
Redefining Work in the Age of AI - What to expect? How to prepare? Why it mat...
Malinda Kapuruge
 

Realtime web experience with signal r