SlideShare uma empresa Scribd logo
1 de 13
Baixar para ler offline
SignalR
Slawomir Dorzak
@sdorzak
What I’ll be talking about
● Scaling out your SignalR application
● Securing your endpoints
● Cross domain calls
● Things to watch out for
● Alternatives to SignalR
Scaling out your SignlaR app
● Why is it important?
○ Cloud deployments usually require more than 2
instances
○ You will need to scale out some day, so better know
your options
● Challenges
○ SignlaR needs to be aware of all connections, it
needs some way of sharing data between multiple
servers
○ All servers in the pool need to be notified when client
sends a message, connects or disconnects
○ Message patterns may vary quite a lot between
applications
Built-in scale-out support
● SignalR backplane
○ Azure ServiceBus
■ No setup needed
■ Reliability provided by ServiceBus
○ SQL Server
■ Database needs to be created upfront
■ Familiar to most developers
○ Redis
■ Install your own or use one of the "as a service"
options
■ Fast - in-memory store
○ NServiceBus
■ 3rd party alternative to Azure ServiceBus
DIY Scale-out
○ One "beefy" server
■ you can tweak it for great performance
■ you need to think about failover
strategy
■ need to be aware of the scale-up
ceiling
○ Context specific
■ great performance
■ can distribute the load more evenly
■ distribution strategy needs to be
thought through
When to use which?
● For most cases - start with built-in backplane
of choice
● If you're expecting high volumes of
messages eg. realtime gaming consider DIY
approach
● See this great talk on the subject:
○ "Scaling the Real-time Web with ASP.NET SignalR"
http://channel9.msdn.com/Events/Build/2013/3-502
Demo
Securing your endpoints
● SignalR doesn't provide any authentication
features
● Use your existing authentication eg. Forms
● Use Authorize attribute to control access to
the hub or hub methods
● Do not display connectionId to the clients as
it is used in identity verification mechanism
Securing your endpoints
● Never blindly trust the client as it can be
hijacked or spoofed
● Don't assume client is always the browser
● Communication over ws:// is unencrypted -
use wss:// instead!
● validate origin of your clients
● encode input that you broadcast to other
clients
Cross domain calls
● on the client SignalR automatically detects
cross domain URL
● it will use XHR by default with fallback to
jsonp
● on the server you need to explicitly allow
cross domain connections
RouteTable.Routes.MapHubs(
new HubConfiguration(){ EnableCrossDomain = true });
Things to watch out for
● You need one of the supported OS-es
(>Windows Server 2008R2 or > Windows 7)
● You need .NET Framework > 4.0
● IIS7 or 7.5 needs URL Extensions module,
IIS8 has builtin support
● On the client you need jQuery 1.6.4+
● For websockets transport you need the
latest browser
● Complicated stack
● DPI
● Don’t put blocking calls in your hub methods
SignalR alternatives
● Socket.IO + NodeJS
○ You can run it on Azure (yes it does run NodeJS :)
○ It's mature and widely used
○ It's not as integrated into .NET environment as
SignalR
● SuperWebSocket
○ Multiple hosting options (windows service, console
app, web app)
○ Supported on Mono
○ Lower level
● Since .NET 4.5 WCF supports Websockets
as transport
Resources
● Low level protocol introduction http://lucumr.pocoo.
org/2012/9/24/websockets-101/
● Excellent paper on websockets security http://www.
adambarth.com/papers/2011/huang-chen-barth-rescorla-jackson.pdf
● Free SignalR ebook
http://eduardopires.net.br/Repositorio/SignalR_eBook.pdf
● SignalR Github account
https://github.com/SignalR/Samples

Mais conteúdo relacionado

Mais procurados

NGINX.conf 2016 - Fail in order to succeed ! Designing Microservices for fail...
NGINX.conf 2016 - Fail in order to succeed ! Designing Microservices for fail...NGINX.conf 2016 - Fail in order to succeed ! Designing Microservices for fail...
NGINX.conf 2016 - Fail in order to succeed ! Designing Microservices for fail...
Dragos Dascalita Haut
 
Scaling and Orchestrating Microservices with OSGi - N Bartlett
Scaling and Orchestrating Microservices with OSGi - N BartlettScaling and Orchestrating Microservices with OSGi - N Bartlett
Scaling and Orchestrating Microservices with OSGi - N Bartlett
mfrancis
 

Mais procurados (20)

NGINX.conf 2016 - Fail in order to succeed ! Designing Microservices for fail...
NGINX.conf 2016 - Fail in order to succeed ! Designing Microservices for fail...NGINX.conf 2016 - Fail in order to succeed ! Designing Microservices for fail...
NGINX.conf 2016 - Fail in order to succeed ! Designing Microservices for fail...
 
Reduce IT Spend with Software Load Balancing
Reduce IT Spend with Software Load BalancingReduce IT Spend with Software Load Balancing
Reduce IT Spend with Software Load Balancing
 
NGINX Amplify: Monitoring NGINX with Advanced Filters and Custom Dashboards
NGINX Amplify: Monitoring NGINX with Advanced Filters and Custom DashboardsNGINX Amplify: Monitoring NGINX with Advanced Filters and Custom Dashboards
NGINX Amplify: Monitoring NGINX with Advanced Filters and Custom Dashboards
 
Automating security for cloud workloads (1)
Automating security for cloud workloads (1)Automating security for cloud workloads (1)
Automating security for cloud workloads (1)
 
Managing and Scaling Puppet - PuppetConf 2014
Managing and Scaling Puppet - PuppetConf 2014Managing and Scaling Puppet - PuppetConf 2014
Managing and Scaling Puppet - PuppetConf 2014
 
Overview of SSL: choose the option that's right for you
Overview of SSL: choose the option that's right for youOverview of SSL: choose the option that's right for you
Overview of SSL: choose the option that's right for you
 
Serverless
ServerlessServerless
Serverless
 
Service Discovery: From Classic to VPC
Service Discovery: From Classic to VPCService Discovery: From Classic to VPC
Service Discovery: From Classic to VPC
 
Scaling and Orchestrating Microservices with OSGi - N Bartlett
Scaling and Orchestrating Microservices with OSGi - N BartlettScaling and Orchestrating Microservices with OSGi - N Bartlett
Scaling and Orchestrating Microservices with OSGi - N Bartlett
 
Microservices
MicroservicesMicroservices
Microservices
 
Lagom framework
Lagom frameworkLagom framework
Lagom framework
 
Hyperledger in AWS
Hyperledger in AWSHyperledger in AWS
Hyperledger in AWS
 
NGINX for Application Delivery & Acceleration
NGINX for Application Delivery & AccelerationNGINX for Application Delivery & Acceleration
NGINX for Application Delivery & Acceleration
 
Microservices in GO lang
Microservices in GO langMicroservices in GO lang
Microservices in GO lang
 
Get acquainted with the new ASP.Net 5
Get acquainted with the new ASP.Net 5Get acquainted with the new ASP.Net 5
Get acquainted with the new ASP.Net 5
 
Microservices Using Docker Containers for Magento 2
Microservices Using Docker Containers for Magento 2Microservices Using Docker Containers for Magento 2
Microservices Using Docker Containers for Magento 2
 
Developing Serverless Microservice in Rust
Developing Serverless Microservice in RustDeveloping Serverless Microservice in Rust
Developing Serverless Microservice in Rust
 
Instruments to play microservice
Instruments to play microserviceInstruments to play microservice
Instruments to play microservice
 
Microservice Workshop Hands On
Microservice Workshop Hands On Microservice Workshop Hands On
Microservice Workshop Hands On
 
BizTalk ALM
BizTalk ALMBizTalk ALM
BizTalk ALM
 

Semelhante a SignalR

Cpp In Soa
Cpp In SoaCpp In Soa
Cpp In Soa
WSO2
 
Kubernetes Clusters At Scale: Managing Hundreds Apache Pinot Kubernetes Clust...
Kubernetes Clusters At Scale: Managing Hundreds Apache Pinot Kubernetes Clust...Kubernetes Clusters At Scale: Managing Hundreds Apache Pinot Kubernetes Clust...
Kubernetes Clusters At Scale: Managing Hundreds Apache Pinot Kubernetes Clust...
Xiaoman DONG
 

Semelhante a SignalR (20)

apidays LIVE Paris - Creating a scalable ecosystem of Microservices by Archan...
apidays LIVE Paris - Creating a scalable ecosystem of Microservices by Archan...apidays LIVE Paris - Creating a scalable ecosystem of Microservices by Archan...
apidays LIVE Paris - Creating a scalable ecosystem of Microservices by Archan...
 
MariaDB Security Best Practices
MariaDB Security Best PracticesMariaDB Security Best Practices
MariaDB Security Best Practices
 
apidays LIVE JAKARTA - 10 commandments for scalable microservices by Archanaa...
apidays LIVE JAKARTA - 10 commandments for scalable microservices by Archanaa...apidays LIVE JAKARTA - 10 commandments for scalable microservices by Archanaa...
apidays LIVE JAKARTA - 10 commandments for scalable microservices by Archanaa...
 
Identity Server on Azure: A Reference Architecture
Identity Server on Azure: A Reference ArchitectureIdentity Server on Azure: A Reference Architecture
Identity Server on Azure: A Reference Architecture
 
Cpp In Soa
Cpp In SoaCpp In Soa
Cpp In Soa
 
SYN224: Best practices for migrating from Web Interface to StoreFront Services
SYN224: Best practices for migrating from Web Interface to StoreFront ServicesSYN224: Best practices for migrating from Web Interface to StoreFront Services
SYN224: Best practices for migrating from Web Interface to StoreFront Services
 
How SignalR Can Simplify Your Messaging Needs? | Virtuoso Infotech
How SignalR Can Simplify Your Messaging Needs? | Virtuoso InfotechHow SignalR Can Simplify Your Messaging Needs? | Virtuoso Infotech
How SignalR Can Simplify Your Messaging Needs? | Virtuoso Infotech
 
Automation Patterns for Scalable Secret Management
Automation Patterns for Scalable Secret ManagementAutomation Patterns for Scalable Secret Management
Automation Patterns for Scalable Secret Management
 
Drupal and security - Advice for Site Builders and Coders
Drupal and security - Advice for Site Builders and CodersDrupal and security - Advice for Site Builders and Coders
Drupal and security - Advice for Site Builders and Coders
 
Messaging-as-a-Service Rivieradev 2017
Messaging-as-a-Service Rivieradev 2017Messaging-as-a-Service Rivieradev 2017
Messaging-as-a-Service Rivieradev 2017
 
Microservices Architecture
Microservices ArchitectureMicroservices Architecture
Microservices Architecture
 
VMware End-User-Computing Best Practices Poster
VMware End-User-Computing Best Practices PosterVMware End-User-Computing Best Practices Poster
VMware End-User-Computing Best Practices Poster
 
Kubernetes Clusters At Scale: Managing Hundreds Apache Pinot Kubernetes Clust...
Kubernetes Clusters At Scale: Managing Hundreds Apache Pinot Kubernetes Clust...Kubernetes Clusters At Scale: Managing Hundreds Apache Pinot Kubernetes Clust...
Kubernetes Clusters At Scale: Managing Hundreds Apache Pinot Kubernetes Clust...
 
How to Choose the Right Technology Stack for Your Successful Crypto Exchange ...
How to Choose the Right Technology Stack for Your Successful Crypto Exchange ...How to Choose the Right Technology Stack for Your Successful Crypto Exchange ...
How to Choose the Right Technology Stack for Your Successful Crypto Exchange ...
 
Insecurity-In-Security version.1 (2010)
Insecurity-In-Security version.1 (2010)Insecurity-In-Security version.1 (2010)
Insecurity-In-Security version.1 (2010)
 
Ch 5: Bypassing Client-Side Controls
Ch 5: Bypassing Client-Side ControlsCh 5: Bypassing Client-Side Controls
Ch 5: Bypassing Client-Side Controls
 
QueueMetrics Live
QueueMetrics LiveQueueMetrics Live
QueueMetrics Live
 
Magento Meetup New Delhi- Magento2 Speed Optimization
Magento Meetup New Delhi- Magento2 Speed OptimizationMagento Meetup New Delhi- Magento2 Speed Optimization
Magento Meetup New Delhi- Magento2 Speed Optimization
 
MRA AMA Part 10: Kubernetes and the Microservices Reference Architecture
MRA AMA Part 10: Kubernetes and the Microservices Reference ArchitectureMRA AMA Part 10: Kubernetes and the Microservices Reference Architecture
MRA AMA Part 10: Kubernetes and the Microservices Reference Architecture
 
What's new in confluent platform 5.4 online talk
What's new in confluent platform 5.4 online talkWhat's new in confluent platform 5.4 online talk
What's new in confluent platform 5.4 online talk
 

Último

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
vu2urc
 

Último (20)

TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation Strategies
 
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
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
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
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
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
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of Brazil
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
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
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 

SignalR

  • 2. What I’ll be talking about ● Scaling out your SignalR application ● Securing your endpoints ● Cross domain calls ● Things to watch out for ● Alternatives to SignalR
  • 3. Scaling out your SignlaR app ● Why is it important? ○ Cloud deployments usually require more than 2 instances ○ You will need to scale out some day, so better know your options ● Challenges ○ SignlaR needs to be aware of all connections, it needs some way of sharing data between multiple servers ○ All servers in the pool need to be notified when client sends a message, connects or disconnects ○ Message patterns may vary quite a lot between applications
  • 4. Built-in scale-out support ● SignalR backplane ○ Azure ServiceBus ■ No setup needed ■ Reliability provided by ServiceBus ○ SQL Server ■ Database needs to be created upfront ■ Familiar to most developers ○ Redis ■ Install your own or use one of the "as a service" options ■ Fast - in-memory store ○ NServiceBus ■ 3rd party alternative to Azure ServiceBus
  • 5. DIY Scale-out ○ One "beefy" server ■ you can tweak it for great performance ■ you need to think about failover strategy ■ need to be aware of the scale-up ceiling ○ Context specific ■ great performance ■ can distribute the load more evenly ■ distribution strategy needs to be thought through
  • 6. When to use which? ● For most cases - start with built-in backplane of choice ● If you're expecting high volumes of messages eg. realtime gaming consider DIY approach ● See this great talk on the subject: ○ "Scaling the Real-time Web with ASP.NET SignalR" http://channel9.msdn.com/Events/Build/2013/3-502
  • 8. Securing your endpoints ● SignalR doesn't provide any authentication features ● Use your existing authentication eg. Forms ● Use Authorize attribute to control access to the hub or hub methods ● Do not display connectionId to the clients as it is used in identity verification mechanism
  • 9. Securing your endpoints ● Never blindly trust the client as it can be hijacked or spoofed ● Don't assume client is always the browser ● Communication over ws:// is unencrypted - use wss:// instead! ● validate origin of your clients ● encode input that you broadcast to other clients
  • 10. Cross domain calls ● on the client SignalR automatically detects cross domain URL ● it will use XHR by default with fallback to jsonp ● on the server you need to explicitly allow cross domain connections RouteTable.Routes.MapHubs( new HubConfiguration(){ EnableCrossDomain = true });
  • 11. Things to watch out for ● You need one of the supported OS-es (>Windows Server 2008R2 or > Windows 7) ● You need .NET Framework > 4.0 ● IIS7 or 7.5 needs URL Extensions module, IIS8 has builtin support ● On the client you need jQuery 1.6.4+ ● For websockets transport you need the latest browser ● Complicated stack ● DPI ● Don’t put blocking calls in your hub methods
  • 12. SignalR alternatives ● Socket.IO + NodeJS ○ You can run it on Azure (yes it does run NodeJS :) ○ It's mature and widely used ○ It's not as integrated into .NET environment as SignalR ● SuperWebSocket ○ Multiple hosting options (windows service, console app, web app) ○ Supported on Mono ○ Lower level ● Since .NET 4.5 WCF supports Websockets as transport
  • 13. Resources ● Low level protocol introduction http://lucumr.pocoo. org/2012/9/24/websockets-101/ ● Excellent paper on websockets security http://www. adambarth.com/papers/2011/huang-chen-barth-rescorla-jackson.pdf ● Free SignalR ebook http://eduardopires.net.br/Repositorio/SignalR_eBook.pdf ● SignalR Github account https://github.com/SignalR/Samples