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
18
votes
5 answers

SignalR Client How to Set user when start connection?

Server side: public override Task OnConnected() { var connectionId = Context.ConnectionId; var user = Context.User.Identity.Name; // Context.User is NULL return base.OnConnected(); } Client side (in Console project): IHubProxy…
wtf512
  • 4,487
  • 9
  • 33
  • 55
18
votes
2 answers

SignalR - sending parameter to OnConnected?

I have the following JS working: var chat = $.connection.appHub; My app has a single hub, AppHub, that handles two types of notifications - Chat and Other. I'm using a single hub because I need access to all connections at all times. I need to be…
RobVious
  • 12,685
  • 25
  • 99
  • 181
18
votes
3 answers

SignalR Timeout Properties

We have come across this link which specifies the different time out properties: https://github.com/SignalR/SignalR/wiki/Configuring-SignalR And also this excellent post (When does a reconnect in signalR occour?) on how disconnections and…
smitra
  • 597
  • 3
  • 6
  • 18
18
votes
2 answers

SignalR client with multiple connections

I have multiple SignalR 'services' running and only one UI to access them. How can I make the client js to talk to multiple connections with different Url? Because it seems I can only specify one url per $.connection.hub, and I can't use multiple…
Adamy
  • 2,789
  • 3
  • 27
  • 25
18
votes
2 answers

SignalR: Hub OnConnected not called if no client methods

I am writing a game in SignalR. The idea is that you connect with your laptop, which will be used as "display" and then you connect with your smart phone and that will be used as "joystick". The entire setup works very well. Now that it all works, I…
pardahlman
  • 1,394
  • 10
  • 22
18
votes
1 answer

SignalR send message to single connectionId

I have an asp.net classic website. ive got SignalR basic functionality to work (where one client send messages to rest of the clients). but now i want to send Messages only to specific connectionsIDs. my Hub : ** [HubName("chatHub")] public…
Timsen
  • 4,066
  • 10
  • 59
  • 117
18
votes
1 answer

SignalR exception logging?

This is more of two questions, but : What's the best way to have a top level exception handler for my Hub? It doesn't seem possible with the current version of SignalR Why doesn't this actually do anything on the client when I throw an error in my…
Brian Rosamilia
  • 1,448
  • 14
  • 24
17
votes
2 answers

SignalR Client Method Fired Multiple Times in Angular Service

I am having a really frustrating issue that I can't seem to get to the bottom of. I am using SignalR to push messages to a mobile device and the client method is being fired multiple times. The amount of times it fires grows when I log out which is…
TheJediCowboy
  • 8,924
  • 28
  • 136
  • 208
17
votes
3 answers

SignalR "Error during negotiation request"

I have socket notification in my application which work great when I run locally, but when I deploy to my VM, it complains giving the following message. Error: Error during negotiation request. at Object.signalR._.error (jquery.signalR.js:178) …
TheJediCowboy
  • 8,924
  • 28
  • 136
  • 208
17
votes
2 answers

"OnDisconnected(): no suitable method found to override" - SignalR

I've been trying to implement a chat room by following the "Asp.Net SignalR Chat Room" tutorial on CodeProject (http://www.codeproject.com/Articles/562023/Asp-Net-SignalR-Chat-Room). However, I'm getting the error "Hubs.ChatHubs.OnDisconnected(): no…
Palindrome
  • 195
  • 1
  • 1
  • 9
17
votes
2 answers

Use Hub methods from controller?

I am using SignalR 2 and I can not figure out how I can use my Hub methods e.g from inside a controller action. I know I can do the following: var hub = GlobalHost.ConnectionManager.GetHubContext(); hub.Clients.All.clientSideMethod(param); But…
Christoph Fink
  • 22,727
  • 9
  • 68
  • 113
17
votes
2 answers

The On event on the SignalR Client Hub does not get called

I seem to have an issue with SignalR's JS Client Hub. The problem is that the 'on' handler does not seem to work - it generates no error but doesn't receive any signals sent by the server. The code below shows an extract where I call the server…
Marcel
  • 2,148
  • 6
  • 31
  • 48
17
votes
4 answers

SignalR - Checking if a user is still connected

I have a hub with method that is called client-side. This method launches a timer with a delegate that runs every 10 seconds. Since it wouldn't make sense to keep running this delegate if no one is connected to the hub, I want to check if any users…
edobry
  • 335
  • 1
  • 5
  • 12
16
votes
2 answers

SignalR version compatability (StatusCode: 405 'Method Not Allowed')

I'm having issues with a SignalR project I'm currently working on. I'm trying to build a server using .Net Core, and a client using traditional .Net (framework 4.6.1). However the server and client don't seem to be compatible. The last issue I've…
16
votes
4 answers

Passing strongly typed Hubs in SignalR

I've just updated some SignalR references and things have changed somewhat in order to allow for generically typed Hubs Hub. In the existing examples and documentation such as at: Server-Broadcast-with-Signalr we have a static class holding…
rism
  • 11,932
  • 16
  • 76
  • 116