Questions tagged [signalr-hub]

Hubs provide a higher level RPC framework over a PersistentConnection. If you have different types of messages that you want to send between server and client then hubs is recommended so you don't have to do your own dispatching.

For a complete specification check out the SignalR Hubs Wiki page.

1597 questions
32
votes
2 answers

SignalR calling client method from outside hub using GlobalHost.ConnectionManager.GetHubContext doesn't work. But calling from within the hub does

I'm trying to call a client method from within a .net Web API controller action. Can I do this? The only post I can find that comes close to what I am looking to do is this one: SignalR + posting a message to a Hub via an action method In there a…
Robert
  • 828
  • 2
  • 13
  • 28
31
votes
3 answers

SignalR doesn't use Session on server

When I try to access the HttpContext current session from the HUB it returns null. I tried making use of the interface IRequiresSession but it didn't work. Can someone help me?
Danillo Corvalan
  • 703
  • 1
  • 10
  • 19
31
votes
1 answer

SignalR OnDisconnected - a reliable way to handle "User is Online" for chatroom?

I'm implementing a chat room. So far, so good - users can send messages from their browsers via a JS client, and I can use a C# client to do the same thing - these messages get broadcast to other users. Now, I'm trying to implement "online…
SB2055
  • 12,272
  • 32
  • 97
  • 202
28
votes
4 answers

Mapping SignalR connections to users

Consider a web application like facebook, that can send realtime notifications to users. What is the best way, using asp.net SignalR, to keep track of which connection ids belong to which user, even if the user disconnects, or reconnects later ?
Daniel Hursan
  • 839
  • 1
  • 9
  • 19
27
votes
10 answers

Signalr/Hub not loading in IIS 7 but working correctly in Visual Studio

I am working on a Web Application on the Asp .Net 4.0 framework that uses SignalR, having installed it from the Nuget package. When I debug or run the application without debugging locally it works correctly. However, when it is deployed to the…
PCasagrande
  • 5,302
  • 3
  • 27
  • 36
27
votes
4 answers

it is possible to stream video with SignalR?

Well I'm trying to perform a proof about video streaming, I'm working with asp.net c#. I'm kind of lost, you have any idea or suggestion?
luis_laurent
  • 784
  • 1
  • 12
  • 32
27
votes
5 answers

SignalR and HttpContext/Session

I understand why SignalR doesn't give you access to the HttpContext. However, this is quite problematic for us. Let me explain: Our application is a Multi-Tenant application where the user chooses the environment while logging in. This basically…
Lodewijk
  • 2,380
  • 4
  • 25
  • 40
25
votes
3 answers

How do I send messages from server to client using SignalR Hubs

I am just starting to explore signalR and I would like to able to send messages from the server to all clients. Here is my Hub using System; using System.Collections.Generic; using System.Linq; using System.Web; using SignalR; using…
David Kethel
  • 2,440
  • 9
  • 29
  • 49
24
votes
1 answer

How to send Parameter/Query in HubConnection SignalR Core

I'm trying to add parameter into connection to signalr. I'm using Builder to create my Client connection and start it: var connection = new HubConnectionBuilder() .WithUrl("http://10.0.2.162:5002/connection") .WithConsoleLogger() …
Pedro Franco
  • 1,926
  • 1
  • 15
  • 37
23
votes
2 answers

SignalR hub method parameter serialization

I would need some guidelines from SignalR developers what is the best way to tweak HUB method's parameters serialization. I started migrating my project from WCF polling duplex (Silverlight 5 - ASP.NET 4.5) to SignalR (1.1.2). The message (data…
eXavier
  • 4,821
  • 4
  • 35
  • 57
22
votes
4 answers

SignalR + Dependency Injection Questions

I am using SignalR in my MVC3 application, and since I have implemented StructureMap Dependency Injection on my controllers I would like to do the same in my hub, but I can't seem to get it working. Please tell me what's wrong with my codes…
22
votes
2 answers

When is the SignalR hub constructor called?

I'm trying to debug a SignalR hub and noticed that the constructor is getting called multiple times, even with a single client. Is this the expected behaviour? I was expecting the constructor to be called only once for class initialisation, but I'm…
Tim
  • 7,746
  • 3
  • 49
  • 83
20
votes
2 answers

SignalR difference between On and Subscribe of IHubProxy

What are the differences between On and Subscribe methods available in IHubProxy interface. When should one use one over the other
Nipuna
  • 6,846
  • 9
  • 64
  • 87
20
votes
4 answers

How do I call a SignalR hub method from the outside?

This is my Hub code: public class Pusher : Hub, IPusher { readonly IHubContext _hubContext = GlobalHost.ConnectionManager.GetHubContext(); public virtual Task PushToOtherInGroup(dynamic group, dynamic data) { return…
user1968030
19
votes
6 answers

The requested Performance Counter is not a custom counter, it has to be initialized as ReadOnly." on RouteTable.Routes.MapHubs();

I'm working with SignalR 1.1.2 version and Windsor Castle in an AspNet MVC 4 application. My problem is that this error message is showing up since I moved to the newer SignalR version. "The requested Performance Counter is not a custom counter, it…
polonskyg
  • 4,269
  • 9
  • 41
  • 93