SlideShare a Scribd company logo
The entire contents of this document are subject to copyright with all rights reserved. All copyrightable text and graphics, the selection, arrangement and presentation
of all information and the overall design of the document are the sole and exclusive property of Virtusa.
Copyright © 2012 Virtusa Corporation. All rights reserved
2000 West Park Drive
Westborough MA 01581 USA
Phone: 508 389 7300 Fax: 508 366 9901
Introduction to SignalR
SharePoint CEG | K-Talk
Shehan Peruma
August 23, 2013
2
Agenda
• Real-Time Web Technologies
• SignalR
• Getting Started
• Hubs API
• SignalR & SharePoint
• Summary
3
Real-Time Web Technologies
4
What?
• Stock Ticker
• Live Scores
• News Feeds
• Dashboards
• VoIP
• Chat
• Auctions
• Activity
Streams
Improved User Experience & Server Performance
D e f i n i t i o n : an application that functions within a time
frame that the user senses as immediate or current.
Real Time Web Technologies
5
How?
Multiple approaches exist to provide near real time functionality, but each has
it’s own set of pros & cons.
• Polling
• Long Polling
• Forever Frame (IE only)
• Server Sent Events (SSE)
• Web Sockets
Real Time Web Technologies
Server
Client
Server
Client
6
Response4
Response3
Response2
Response1
Web Sockets – Quick Intro.
• Part of the Html 5 specification
• Full-duplex (unlike HTTP)
• Built on top of HTTP – can share
HTTP ports (i.e. 80 & 443)
• URL: ws:// & wss:// similar to
http:// & https://
• Client & Server support required
Real Time Web Technologies
Server
Client
Request1
Request2
Request3
Request4
Time
Frame3
Frame2
Frame1
Handshake
Response
Server
Client
Handshake
Request
Time
Frame4
PollingWebSockets
7
8
• Initially developed by members of the ASP.NET team
• Part of the ASP.NET Technologies
• Open source and hosted on GitHub
• Distributed via NuGet
• Requires .NET 4.0 and above
What is SignalR?
S i g n a l R : An ASP.NET asynchronous, persistent
signaling library that enables the real-time, multi-user
web functionality for applications.
SignalR
9
Demo – A Simple Example
11
Transports
Long
Polling
Forever
Frame
Server
Sent
Events
Web
Sockets
SignalR
12
Demo – Transport Fallback
14
Supported Clients & Hosts
Client
JavaScript
Silverlight
5
Windows
Phone 8
.NETWinRT
iOS
Android
SignalR
Host
ASP.NET
Self-Hosting
(OWIN)
15
Demo – Clients
17
Connections & Hubs
SignalR
Persisted Connections (low-level)
• Can communicate with 1 to N clients
• Is an IHttpHandler
• Requires a route to be defined
• Limited to sending messages
• You define the “protocol”
Hubs (high-level)
• Can communicate with 1 to N clients
• Abstraction over
PersistentConnection
• Route automatically mapped
(/signalr/hubs)
• Can send messages and call
methods
• SignalR defines the protocol
18
Hubs
• Hub methods can be called by the
clients (e.g. javascript)
• Client methods can be called by
the Hub
• Can send messages to all or
individual clients
• Ability to add clients to groups
• Messages can be sent to groups
• Handles connection lifetime
events
SignalR
19
jQuery Proxy
• Two approaches:
• with generated proxy
• Use signalr.exe tool to create the proxy file.
• Without proxy but ‘late binding’
• Can be accessed by navigating to http://yoursite/signalr/hubs
• The proxy simplifies the code needed to communicate with the
server
SignalR
20
Getting Started
21
Installing NuGet Packages
Getting Started
Search for SignalRInstall Microsoft ASP.NET SignalR
The required scripts & assemblies
will be added to the project.
22
Route Mapping
Getting Started
Defined in Global.asax
Defines the routes the client will use to connect to the hub
Part of System.Web.Routing
23
Hub Class
Getting Started
Inherits from Microsoft.AspNet.SignalR.Hub
Sends the message to all the clients by
calling the clients broadcastMessage method
Connected clients can call
the Hubs NewMessage method
24
Client (JavaScript)
• Add reference to JavaScript
files
• Get reference to Hub
• Wireup events
• Start hub connection
• Call hub methods
Getting Started
25
Demo – Code/App
26
Hubs API
27
Groups
Hubs API
• Provides the ability to broadcast messages to a selected set of
clients
• Groups are not persisted on the server
• No API to retrieve group count or members
The developer would need to
keep track of this (e.g.
database).
Adding a client to a group
Sending
messages
to a group
28
Demo – Groups
29
• Override the event handlers
• OnConnected
• OnReconnected
• OnDisconnected
• JavaScript methods available to notify client about connectivity
states
• $.connection.hub.connectionSlow
• $.connection.hub.reconnecting
• $.connection.hub.reconnected
• $.connection.hub.disconnected
Lifetime/Lifecycle Events
Hubs API
30
• Send data to connected clients by calling methods from outside
the Hub
HubContext
Hubs API
SignalR Client SignalR Server
Windows
Service/Scheduler
The Hub classMethod belongs to a class that is not a Hub
Call the client method
31
Demo – HubContext
32
• Authorize - specify which users or roles have access to a hub or
method
• Scaleout
• Windows Azure Service Bus
• Redis
• SQL Server
Other Features
Hubs API
33
SignalR & SharePoint
34
• Create a ASP.NET Web Application
• Install SignalR using nuget
• Create the Hub
• Update Global.asax
• Publish
• Set web application pool to use .Net Framework 4.0 (you might
need to run the aspnet_regiis after changing the framework)
• Optional:
• Set the port to 80 and provide a host header (make sure to
update the host file with the same header name)
• Navigate to the site and ensure you can access the JavaScript
hub proxy (i.e. http://signalr.mydomain.com/signalr/hubs)
Hub Setup
SignalR & SharePoint
35
• Within the page/CEWP/Webpart,etc.. Add reference to the
scripts in the hubs site
• Set jQuery to support cross domain communication
• Set the hub url
• Start the connection
Client Setup (SharePoint 2010)
SignalR & SharePoint
36
Demo – SignalR & SharePoint
37
Summary
38
Summary
• Provides the ability to add real time web functionality to
applications
• Push data to clients and/or groups
• Hubs enables remote procedure calls (RPCs) to be made from a
server to connected clients and from clients to the server
• Not limited to web clients
39
Resources
• SignalR documentation - http://www.asp.net/signalr
• Pluralsight training -
http://pluralsight.com/training/Player?author=christian-
weyer&name=signalr-introduction-m2-
realtime&mode=live&clip=0&course=signalr-introduction
40
Q&A
Q&A
41
Thanks!
Thank you for attending!
www.virtusa.com
© 2012 All rights reserved. Virtusa and all other related logos are either registered trademarks or trademarks of Virtusa Corporation in the United States, the European Union, and/or India. All
other company and service names are the property of their respective holders and may be registered trademarks or trademarks in the United States and/or other countries.

More Related Content

PPT
Intro to signalR
PPTX
SignalR Overview
PPSX
SignalR With ASP.Net part1
PPTX
Introduction to SignalR
PDF
Spring Security
PDF
Spring Framework - AOP
PPT
Source Code Analysis with SAST
PPTX
Real-time ASP.NET with SignalR
Intro to signalR
SignalR Overview
SignalR With ASP.Net part1
Introduction to SignalR
Spring Security
Spring Framework - AOP
Source Code Analysis with SAST
Real-time ASP.NET with SignalR

What's hot (20)

PPTX
SignalR for ASP.NET Developers
PPTX
Rest assured
PPTX
Elastic stack Presentation
PPT
Introduction to the Web API
PPTX
REST-API introduction for developers
PPTX
Rest API Security
PPTX
Spring boot
PDF
Microservices with Java, Spring Boot and Spring Cloud
PDF
Api Gateway
PDF
OAuth2 and Spring Security
PPTX
Json Web Token - JWT
PPTX
Rest assured
PPTX
Project Orleans - Actor Model framework
PDF
Auto scaling using Amazon Web Services ( AWS )
PDF
APIsecure 2023 - API orchestration: to build resilient applications, Cherish ...
PPTX
REST API Design & Development
PDF
Spring boot introduction
PDF
DevSecOps Jenkins Pipeline -Security
PDF
Angular 2 Essential Training
PDF
Spring Native and Spring AOT
SignalR for ASP.NET Developers
Rest assured
Elastic stack Presentation
Introduction to the Web API
REST-API introduction for developers
Rest API Security
Spring boot
Microservices with Java, Spring Boot and Spring Cloud
Api Gateway
OAuth2 and Spring Security
Json Web Token - JWT
Rest assured
Project Orleans - Actor Model framework
Auto scaling using Amazon Web Services ( AWS )
APIsecure 2023 - API orchestration: to build resilient applications, Cherish ...
REST API Design & Development
Spring boot introduction
DevSecOps Jenkins Pipeline -Security
Angular 2 Essential Training
Spring Native and Spring AOT
Ad

Viewers also liked (20)

PPTX
SignalR with asp.net
PPTX
Real time Communication with Signalr (Android Client)
PPTX
SignalR
PDF
ELEIÇÕES 2012 - ASTORGA: Toninho 31123
PPTX
Real time web applications with SignalR (BNE .NET UG)
PPTX
Building Realtime Web Applications With ASP.NET SignalR
PPTX
«Real Time» Web Applications with SignalR in ASP.NET
PPTX
SignalR
PPTX
Real time web with SignalR
PDF
SignalR
PDF
Startups Getting Started
PDF
Anatomy of a Modern Node.js Application Architecture
PPT
Understanding REST
PPTX
REST & RESTful Web Services
PDF
RESTful Web Services
PPTX
Ppt on World Of Smartphones
PDF
RESTful API Design, Second Edition
PPTX
Presentation social network
PPTX
Social Media Marketing For Business
PPT
Social networking PPT
SignalR with asp.net
Real time Communication with Signalr (Android Client)
SignalR
ELEIÇÕES 2012 - ASTORGA: Toninho 31123
Real time web applications with SignalR (BNE .NET UG)
Building Realtime Web Applications With ASP.NET SignalR
«Real Time» Web Applications with SignalR in ASP.NET
SignalR
Real time web with SignalR
SignalR
Startups Getting Started
Anatomy of a Modern Node.js Application Architecture
Understanding REST
REST & RESTful Web Services
RESTful Web Services
Ppt on World Of Smartphones
RESTful API Design, Second Edition
Presentation social network
Social Media Marketing For Business
Social networking PPT
Ad

Similar to Introduction to SignalR (20)

PPTX
Real-time web applications using SharePoint, SignalR and Azure Service Bus
PPTX
signalr
PPTX
SignalR Dublin ALT.NET
PPTX
Building Real Time Applications with ASP.NET SignalR 2.0 by Rachel Appel
PPTX
Signal r
PPTX
Asynchrone Echtzeitanwendungen für SharePoint mit SignalR und knockout.js
PPTX
SignalR powered real-time x-plat mobile apps!
PPTX
Real-time Communications with SignalR
PPTX
SignalR Powered X-Platform Real-Time Apps!
PPTX
Real-Time Communication
PDF
PPTX
ASP.NET MVC 5 and SignalR 2
PPTX
SignalR Intro + WPDev
PPTX
Web e device in real time con asp.net Signal R
PPTX
How To Build Real-Time Applications With ASP.NET Core SignalR
PDF
How SignalR Can Simplify Your Messaging Needs? | Virtuoso Infotech
PPTX
SignalR + Mobile Possibilities
PPTX
Signal r azurepresentation
PPTX
SignalR
PDF
An In-Depth Comparison of WebSocket and SignalR: Pros, Cons, and Use Cases
Real-time web applications using SharePoint, SignalR and Azure Service Bus
signalr
SignalR Dublin ALT.NET
Building Real Time Applications with ASP.NET SignalR 2.0 by Rachel Appel
Signal r
Asynchrone Echtzeitanwendungen für SharePoint mit SignalR und knockout.js
SignalR powered real-time x-plat mobile apps!
Real-time Communications with SignalR
SignalR Powered X-Platform Real-Time Apps!
Real-Time Communication
ASP.NET MVC 5 and SignalR 2
SignalR Intro + WPDev
Web e device in real time con asp.net Signal R
How To Build Real-Time Applications With ASP.NET Core SignalR
How SignalR Can Simplify Your Messaging Needs? | Virtuoso Infotech
SignalR + Mobile Possibilities
Signal r azurepresentation
SignalR
An In-Depth Comparison of WebSocket and SignalR: Pros, Cons, and Use Cases

More from University of Hawai‘i at Mānoa (20)

PDF
Exploring Code Comprehension in Scientific Programming: Preliminary Insight...
PDF
Exploring Accessibility Trends and Challenges in Mobile App Development: A St...
PDF
The Impact of Generative AI-Powered Code Generation Tools on Software Enginee...
PDF
Mobile App Security Trends and Topics: An Examination of Questions From Stack...
PDF
On the Rationale and Use of Assertion Messages in Test Code: Insights from So...
PDF
A Developer-Centric Study Exploring Mobile Application Security Practices and...
PDF
Building Hawaii’s IT Future Together CIO Council & UH Manoa ICS Collaboration
PDF
Impostor Syndrome in Final Year Computer Science Students: An Eye Tracking an...
PDF
An Exploratory Study on the Occurrence of Self-Admitted Technical Debt in And...
PDF
Performance Comparison of Binary Machine Learning Classifiers in Identifying ...
PDF
Rename Chains: An Exploratory Study on the Occurrence and Characteristics of ...
PDF
A Primer on High-Quality Identifier Naming [ASE 2022]
PDF
Supporting the Maintenance of Identifier Names: A Holistic Approach to High-Q...
PDF
Preparing for the Academic Job Market: Experience and Tips from a Recent F...
PDF
Refactoring Debt: Myth or Reality? An Exploratory Study on the Relationship B...
PDF
A Primer on High-Quality Identifier Naming
PDF
Test Anti-Patterns: From Definition to Detection
PDF
Refactoring Debt: Myth or Reality? An Exploratory Study on the Relationship B...
PDF
Understanding Digits in Identifier Names: An Exploratory Study
PDF
How Do I Refactor This? An Empirical Study on Refactoring Trends and Topics i...
Exploring Code Comprehension in Scientific Programming: Preliminary Insight...
Exploring Accessibility Trends and Challenges in Mobile App Development: A St...
The Impact of Generative AI-Powered Code Generation Tools on Software Enginee...
Mobile App Security Trends and Topics: An Examination of Questions From Stack...
On the Rationale and Use of Assertion Messages in Test Code: Insights from So...
A Developer-Centric Study Exploring Mobile Application Security Practices and...
Building Hawaii’s IT Future Together CIO Council & UH Manoa ICS Collaboration
Impostor Syndrome in Final Year Computer Science Students: An Eye Tracking an...
An Exploratory Study on the Occurrence of Self-Admitted Technical Debt in And...
Performance Comparison of Binary Machine Learning Classifiers in Identifying ...
Rename Chains: An Exploratory Study on the Occurrence and Characteristics of ...
A Primer on High-Quality Identifier Naming [ASE 2022]
Supporting the Maintenance of Identifier Names: A Holistic Approach to High-Q...
Preparing for the Academic Job Market: Experience and Tips from a Recent F...
Refactoring Debt: Myth or Reality? An Exploratory Study on the Relationship B...
A Primer on High-Quality Identifier Naming
Test Anti-Patterns: From Definition to Detection
Refactoring Debt: Myth or Reality? An Exploratory Study on the Relationship B...
Understanding Digits in Identifier Names: An Exploratory Study
How Do I Refactor This? An Empirical Study on Refactoring Trends and Topics i...

Recently uploaded (20)

PPTX
CHAPTER 12 - CYBER SECURITY AND FUTURE SKILLS (1) (1).pptx
PDF
Why TechBuilder is the Future of Pickup and Delivery App Development (1).pdf
PDF
PTS Company Brochure 2025 (1).pdf.......
PDF
Adobe Illustrator 28.6 Crack My Vision of Vector Design
PDF
Softaken Excel to vCard Converter Software.pdf
PDF
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025
PPTX
ManageIQ - Sprint 268 Review - Slide Deck
PPTX
Oracle E-Business Suite: A Comprehensive Guide for Modern Enterprises
PDF
Understanding Forklifts - TECH EHS Solution
PDF
Internet Downloader Manager (IDM) Crack 6.42 Build 41
PDF
Wondershare Filmora 15 Crack With Activation Key [2025
PPTX
Odoo POS Development Services by CandidRoot Solutions
PDF
Which alternative to Crystal Reports is best for small or large businesses.pdf
PDF
T3DD25 TYPO3 Content Blocks - Deep Dive by André Kraus
PDF
How to Choose the Right IT Partner for Your Business in Malaysia
PDF
How to Migrate SBCGlobal Email to Yahoo Easily
PPTX
Introduction to Artificial Intelligence
PPTX
L1 - Introduction to python Backend.pptx
PDF
Raksha Bandhan Grocery Pricing Trends in India 2025.pdf
PDF
Nekopoi APK 2025 free lastest update
CHAPTER 12 - CYBER SECURITY AND FUTURE SKILLS (1) (1).pptx
Why TechBuilder is the Future of Pickup and Delivery App Development (1).pdf
PTS Company Brochure 2025 (1).pdf.......
Adobe Illustrator 28.6 Crack My Vision of Vector Design
Softaken Excel to vCard Converter Software.pdf
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025
ManageIQ - Sprint 268 Review - Slide Deck
Oracle E-Business Suite: A Comprehensive Guide for Modern Enterprises
Understanding Forklifts - TECH EHS Solution
Internet Downloader Manager (IDM) Crack 6.42 Build 41
Wondershare Filmora 15 Crack With Activation Key [2025
Odoo POS Development Services by CandidRoot Solutions
Which alternative to Crystal Reports is best for small or large businesses.pdf
T3DD25 TYPO3 Content Blocks - Deep Dive by André Kraus
How to Choose the Right IT Partner for Your Business in Malaysia
How to Migrate SBCGlobal Email to Yahoo Easily
Introduction to Artificial Intelligence
L1 - Introduction to python Backend.pptx
Raksha Bandhan Grocery Pricing Trends in India 2025.pdf
Nekopoi APK 2025 free lastest update

Introduction to SignalR

  • 1. The entire contents of this document are subject to copyright with all rights reserved. All copyrightable text and graphics, the selection, arrangement and presentation of all information and the overall design of the document are the sole and exclusive property of Virtusa. Copyright © 2012 Virtusa Corporation. All rights reserved 2000 West Park Drive Westborough MA 01581 USA Phone: 508 389 7300 Fax: 508 366 9901 Introduction to SignalR SharePoint CEG | K-Talk Shehan Peruma August 23, 2013
  • 2. 2 Agenda • Real-Time Web Technologies • SignalR • Getting Started • Hubs API • SignalR & SharePoint • Summary
  • 4. 4 What? • Stock Ticker • Live Scores • News Feeds • Dashboards • VoIP • Chat • Auctions • Activity Streams Improved User Experience & Server Performance D e f i n i t i o n : an application that functions within a time frame that the user senses as immediate or current. Real Time Web Technologies
  • 5. 5 How? Multiple approaches exist to provide near real time functionality, but each has it’s own set of pros & cons. • Polling • Long Polling • Forever Frame (IE only) • Server Sent Events (SSE) • Web Sockets Real Time Web Technologies Server Client Server Client
  • 6. 6 Response4 Response3 Response2 Response1 Web Sockets – Quick Intro. • Part of the Html 5 specification • Full-duplex (unlike HTTP) • Built on top of HTTP – can share HTTP ports (i.e. 80 & 443) • URL: ws:// & wss:// similar to http:// & https:// • Client & Server support required Real Time Web Technologies Server Client Request1 Request2 Request3 Request4 Time Frame3 Frame2 Frame1 Handshake Response Server Client Handshake Request Time Frame4 PollingWebSockets
  • 7. 7
  • 8. 8 • Initially developed by members of the ASP.NET team • Part of the ASP.NET Technologies • Open source and hosted on GitHub • Distributed via NuGet • Requires .NET 4.0 and above What is SignalR? S i g n a l R : An ASP.NET asynchronous, persistent signaling library that enables the real-time, multi-user web functionality for applications. SignalR
  • 9. 9 Demo – A Simple Example
  • 12. 14 Supported Clients & Hosts Client JavaScript Silverlight 5 Windows Phone 8 .NETWinRT iOS Android SignalR Host ASP.NET Self-Hosting (OWIN)
  • 14. 17 Connections & Hubs SignalR Persisted Connections (low-level) • Can communicate with 1 to N clients • Is an IHttpHandler • Requires a route to be defined • Limited to sending messages • You define the “protocol” Hubs (high-level) • Can communicate with 1 to N clients • Abstraction over PersistentConnection • Route automatically mapped (/signalr/hubs) • Can send messages and call methods • SignalR defines the protocol
  • 15. 18 Hubs • Hub methods can be called by the clients (e.g. javascript) • Client methods can be called by the Hub • Can send messages to all or individual clients • Ability to add clients to groups • Messages can be sent to groups • Handles connection lifetime events SignalR
  • 16. 19 jQuery Proxy • Two approaches: • with generated proxy • Use signalr.exe tool to create the proxy file. • Without proxy but ‘late binding’ • Can be accessed by navigating to http://yoursite/signalr/hubs • The proxy simplifies the code needed to communicate with the server SignalR
  • 18. 21 Installing NuGet Packages Getting Started Search for SignalRInstall Microsoft ASP.NET SignalR The required scripts & assemblies will be added to the project.
  • 19. 22 Route Mapping Getting Started Defined in Global.asax Defines the routes the client will use to connect to the hub Part of System.Web.Routing
  • 20. 23 Hub Class Getting Started Inherits from Microsoft.AspNet.SignalR.Hub Sends the message to all the clients by calling the clients broadcastMessage method Connected clients can call the Hubs NewMessage method
  • 21. 24 Client (JavaScript) • Add reference to JavaScript files • Get reference to Hub • Wireup events • Start hub connection • Call hub methods Getting Started
  • 24. 27 Groups Hubs API • Provides the ability to broadcast messages to a selected set of clients • Groups are not persisted on the server • No API to retrieve group count or members The developer would need to keep track of this (e.g. database). Adding a client to a group Sending messages to a group
  • 26. 29 • Override the event handlers • OnConnected • OnReconnected • OnDisconnected • JavaScript methods available to notify client about connectivity states • $.connection.hub.connectionSlow • $.connection.hub.reconnecting • $.connection.hub.reconnected • $.connection.hub.disconnected Lifetime/Lifecycle Events Hubs API
  • 27. 30 • Send data to connected clients by calling methods from outside the Hub HubContext Hubs API SignalR Client SignalR Server Windows Service/Scheduler The Hub classMethod belongs to a class that is not a Hub Call the client method
  • 29. 32 • Authorize - specify which users or roles have access to a hub or method • Scaleout • Windows Azure Service Bus • Redis • SQL Server Other Features Hubs API
  • 31. 34 • Create a ASP.NET Web Application • Install SignalR using nuget • Create the Hub • Update Global.asax • Publish • Set web application pool to use .Net Framework 4.0 (you might need to run the aspnet_regiis after changing the framework) • Optional: • Set the port to 80 and provide a host header (make sure to update the host file with the same header name) • Navigate to the site and ensure you can access the JavaScript hub proxy (i.e. http://signalr.mydomain.com/signalr/hubs) Hub Setup SignalR & SharePoint
  • 32. 35 • Within the page/CEWP/Webpart,etc.. Add reference to the scripts in the hubs site • Set jQuery to support cross domain communication • Set the hub url • Start the connection Client Setup (SharePoint 2010) SignalR & SharePoint
  • 33. 36 Demo – SignalR & SharePoint
  • 35. 38 Summary • Provides the ability to add real time web functionality to applications • Push data to clients and/or groups • Hubs enables remote procedure calls (RPCs) to be made from a server to connected clients and from clients to the server • Not limited to web clients
  • 36. 39 Resources • SignalR documentation - http://www.asp.net/signalr • Pluralsight training - http://pluralsight.com/training/Player?author=christian- weyer&name=signalr-introduction-m2- realtime&mode=live&clip=0&course=signalr-introduction
  • 39. www.virtusa.com © 2012 All rights reserved. Virtusa and all other related logos are either registered trademarks or trademarks of Virtusa Corporation in the United States, the European Union, and/or India. All other company and service names are the property of their respective holders and may be registered trademarks or trademarks in the United States and/or other countries.