SlideShare uma empresa Scribd logo
1 de 17
Topics Focused On!!!
• HubName Attribute
• HubMethodName Attribute
• Strongly-Typed Hubs
• Synchronous – Asynchronous Method
• Complex object
• Information about the client
• Selecting which clients will receive the RPC
HubName Attribute
If you want to specify a different Hub name for clients to
use, add the HubName attribute.
HubMethodName Attribute
If you want to specify a different Hub method name for
clients to use, add the HubMethodName attribute.
Strongly-Typed Hubs
To define an interface for your hub methods that your
client can reference.
Synchronous – Asynchronous
Method
Making a Hub method asynchronous avoids blocking the
connection when it uses the WebSocket transport. When
a Hub method executes synchronously and the transport
is WebSocket, subsequent invocations of methods on the
Hub from the same client are blocked until the Hub
method completes.
Write async method
• Server:
Demo
Complex object
Information about the client
• The connection ID of the calling client.
– string connectionID = Context.ConnectionId;
The connection ID is a GUID that is assigned by SignalR
(you can't specify the value in your own code). There is
one connection ID for each connection, and the same
connection ID is used by all Hubs if you have multiple
Hubs in your application.
QueryString
• Query string data.
– In Server
• Microsoft.AspNet.SignalR.Hosting.INameValueCollection queryString =
Context.Request.QueryString;
• string parameterValue = queryString["parametername"]
– In Client
• $.connection.hub.qs = { username' : ‘value' };
• You can add query string parameters in the client by
configuring the connection, which is a convenient way to
pass data about the client from the client to the server.
Demo
Selecting which clients will receive
the RPC 1
• All connected clients.
– Clients.All.ViewMessage(name, message);
• Only the calling client.
– Clients.Caller.ViewMessage (name, message);
• All clients except the calling client.
– Clients.Others.ViewMessage(name, message);
• A specific client identified by connection ID.
– Clients.Client(ConnectionId).ViewMessage(name, message);
Selecting which clients will receive
the RPC 2
• All connected clients except the specified clients, identified by
connection ID.
– Clients.AllExcept(connectionId1, connectionId2).ViewMessage(name,
message);
• All connected clients in a specified group.
– Clients.Group(groupName).ViewMessage(name, message);
• All connected clients in a specified group except the specified
clients, identified by connection ID.
– Clients.Group(groupName, connectionId1, connectionId2).
ViewMessage(name, message);
Selecting which clients will receive
the RPC 3
• All connected clients in a specified group except the
calling client.
– Clients.OthersInGroup(groupName).ViewMessage(name,
message);
• All clients and groups in a list of connection IDs.
– Clients.Clients(ConnectionIds).ViewMessage(name, message);
• A list of groups.
– Clients.Groups(GroupIds).ViewMessage(name, message);
Demo
Thanks

Mais conteúdo relacionado

Mais procurados

SignalR. Code, not toothpaste - TechDays Belgium 2012
SignalR. Code, not toothpaste - TechDays Belgium 2012SignalR. Code, not toothpaste - TechDays Belgium 2012
SignalR. Code, not toothpaste - TechDays Belgium 2012
Maarten Balliauw
 

Mais procurados (20)

Introduction to SignalR
Introduction to SignalRIntroduction to SignalR
Introduction to SignalR
 
Introduction to SignalR
Introduction to SignalRIntroduction to SignalR
Introduction to SignalR
 
Real-time ASP.NET with SignalR
Real-time ASP.NET with SignalRReal-time ASP.NET with SignalR
Real-time ASP.NET with SignalR
 
SignalR
SignalRSignalR
SignalR
 
SignalR with asp.net
SignalR with asp.netSignalR with asp.net
SignalR with asp.net
 
signalr
signalrsignalr
signalr
 
Intro to signalR
Intro to signalRIntro to signalR
Intro to signalR
 
SignalR
SignalRSignalR
SignalR
 
SignalR Overview
SignalR OverviewSignalR Overview
SignalR Overview
 
Signal R 2015
Signal R 2015Signal R 2015
Signal R 2015
 
Real-time Communications with SignalR
Real-time Communications with SignalRReal-time Communications with SignalR
Real-time Communications with SignalR
 
Real time web applications with SignalR (BNE .NET UG)
Real time web applications with SignalR (BNE .NET UG)Real time web applications with SignalR (BNE .NET UG)
Real time web applications with SignalR (BNE .NET UG)
 
Scale your signalR realtime web application
Scale your signalR realtime web applicationScale your signalR realtime web application
Scale your signalR realtime web application
 
We don't need consensus: All agreed?
We don't need consensus: All agreed?We don't need consensus: All agreed?
We don't need consensus: All agreed?
 
Server-Sent Events in Action
Server-Sent Events in ActionServer-Sent Events in Action
Server-Sent Events in Action
 
Building a [micro]services platform on AWS
Building a [micro]services platform on AWSBuilding a [micro]services platform on AWS
Building a [micro]services platform on AWS
 
SignalR. Code, not toothpaste - TechDays Belgium 2012
SignalR. Code, not toothpaste - TechDays Belgium 2012SignalR. Code, not toothpaste - TechDays Belgium 2012
SignalR. Code, not toothpaste - TechDays Belgium 2012
 
Istio Service Mesh
Istio Service MeshIstio Service Mesh
Istio Service Mesh
 
Best Features of Azure Service Bus
Best Features of Azure Service BusBest Features of Azure Service Bus
Best Features of Azure Service Bus
 
Grokking microservices in 5 minutes
Grokking microservices in 5 minutesGrokking microservices in 5 minutes
Grokking microservices in 5 minutes
 

Semelhante a Signalr with ASP.Net part2

Espositoajaxremote 1210732828647866-8
Espositoajaxremote 1210732828647866-8Espositoajaxremote 1210732828647866-8
Espositoajaxremote 1210732828647866-8
Sopheak Sem
 

Semelhante a Signalr with ASP.Net part2 (20)

Real Time App with SignalR
Real Time App with SignalRReal Time App with SignalR
Real Time App with SignalR
 
Java socket programming
Java socket programmingJava socket programming
Java socket programming
 
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
 
Windows 8 Metro apps and the outside world
Windows 8 Metro apps and the outside worldWindows 8 Metro apps and the outside world
Windows 8 Metro apps and the outside world
 
web services-May 25.ppt
web services-May 25.pptweb services-May 25.ppt
web services-May 25.ppt
 
Mule (aws)sns
Mule (aws)snsMule (aws)sns
Mule (aws)sns
 
Real time app with SignalR
Real time app with SignalR Real time app with SignalR
Real time app with SignalR
 
Espositoajaxremote 1210732828647866-8
Espositoajaxremote 1210732828647866-8Espositoajaxremote 1210732828647866-8
Espositoajaxremote 1210732828647866-8
 
Introduction to API and Service Hosting 3.7
Introduction to API and Service Hosting 3.7Introduction to API and Service Hosting 3.7
Introduction to API and Service Hosting 3.7
 
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
 
Real-Time Communication
Real-Time CommunicationReal-Time Communication
Real-Time Communication
 
SFDC Outbound Integrations
SFDC Outbound IntegrationsSFDC Outbound Integrations
SFDC Outbound Integrations
 
SCWCD : The web client model : CHAP : 1
SCWCD  : The web client model : CHAP : 1SCWCD  : The web client model : CHAP : 1
SCWCD : The web client model : CHAP : 1
 
3429 How to transform your messaging environment to a secure messaging envi...
3429   How to transform your messaging environment to a secure messaging envi...3429   How to transform your messaging environment to a secure messaging envi...
3429 How to transform your messaging environment to a secure messaging envi...
 
Chapter 4--converted.pptx
Chapter 4--converted.pptxChapter 4--converted.pptx
Chapter 4--converted.pptx
 
SCWCD : The web client model
SCWCD : The web client modelSCWCD : The web client model
SCWCD : The web client model
 
Httpbasics 1207412539273264-9-converted
Httpbasics 1207412539273264-9-convertedHttpbasics 1207412539273264-9-converted
Httpbasics 1207412539273264-9-converted
 
Developing and Hosting SOAP Based Services
Developing and Hosting SOAP Based ServicesDeveloping and Hosting SOAP Based Services
Developing and Hosting SOAP Based Services
 
.NET Core, ASP.NET Core Course, Session 19
 .NET Core, ASP.NET Core Course, Session 19 .NET Core, ASP.NET Core Course, Session 19
.NET Core, ASP.NET Core Course, Session 19
 
Making communication across boundaries simple with Azure Service Bus
Making communication across boundaries simple with Azure Service BusMaking communication across boundaries simple with Azure Service Bus
Making communication across boundaries simple with Azure Service Bus
 

Último

CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
Health
 
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfintroduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
VishalKumarJha10
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
VictorSzoltysek
 

Último (20)

VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learn
 
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS LiveVip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
 
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) SolutionIntroducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
 
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension AidDirect Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
 
How to Choose the Right Laravel Development Partner in New York City_compress...
How to Choose the Right Laravel Development Partner in New York City_compress...How to Choose the Right Laravel Development Partner in New York City_compress...
How to Choose the Right Laravel Development Partner in New York City_compress...
 
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfintroduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docx
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
 

Signalr with ASP.Net part2

  • 1.
  • 2. Topics Focused On!!! • HubName Attribute • HubMethodName Attribute • Strongly-Typed Hubs • Synchronous – Asynchronous Method • Complex object • Information about the client • Selecting which clients will receive the RPC
  • 3. HubName Attribute If you want to specify a different Hub name for clients to use, add the HubName attribute.
  • 4. HubMethodName Attribute If you want to specify a different Hub method name for clients to use, add the HubMethodName attribute.
  • 5. Strongly-Typed Hubs To define an interface for your hub methods that your client can reference.
  • 6. Synchronous – Asynchronous Method Making a Hub method asynchronous avoids blocking the connection when it uses the WebSocket transport. When a Hub method executes synchronously and the transport is WebSocket, subsequent invocations of methods on the Hub from the same client are blocked until the Hub method completes.
  • 10. Information about the client • The connection ID of the calling client. – string connectionID = Context.ConnectionId; The connection ID is a GUID that is assigned by SignalR (you can't specify the value in your own code). There is one connection ID for each connection, and the same connection ID is used by all Hubs if you have multiple Hubs in your application.
  • 11. QueryString • Query string data. – In Server • Microsoft.AspNet.SignalR.Hosting.INameValueCollection queryString = Context.Request.QueryString; • string parameterValue = queryString["parametername"] – In Client • $.connection.hub.qs = { username' : ‘value' }; • You can add query string parameters in the client by configuring the connection, which is a convenient way to pass data about the client from the client to the server.
  • 12. Demo
  • 13. Selecting which clients will receive the RPC 1 • All connected clients. – Clients.All.ViewMessage(name, message); • Only the calling client. – Clients.Caller.ViewMessage (name, message); • All clients except the calling client. – Clients.Others.ViewMessage(name, message); • A specific client identified by connection ID. – Clients.Client(ConnectionId).ViewMessage(name, message);
  • 14. Selecting which clients will receive the RPC 2 • All connected clients except the specified clients, identified by connection ID. – Clients.AllExcept(connectionId1, connectionId2).ViewMessage(name, message); • All connected clients in a specified group. – Clients.Group(groupName).ViewMessage(name, message); • All connected clients in a specified group except the specified clients, identified by connection ID. – Clients.Group(groupName, connectionId1, connectionId2). ViewMessage(name, message);
  • 15. Selecting which clients will receive the RPC 3 • All connected clients in a specified group except the calling client. – Clients.OthersInGroup(groupName).ViewMessage(name, message); • All clients and groups in a list of connection IDs. – Clients.Clients(ConnectionIds).ViewMessage(name, message); • A list of groups. – Clients.Groups(GroupIds).ViewMessage(name, message);
  • 16. Demo