Questions tagged [signalr-hub]

8

votes
1

answer
302

Views

How to catch ASP.NET Core 2 SignalR exceptions on server-side and handle them on client side with JavaScript?

Context: There are differences between ASP.NET SignalR and ASP.NET Core SignalR you can read here. As described in this stackoverflow post in ASP.NET SignalR you can catch unhandled exceptions on server side via the HubPipelineModule which not exists in ASP.NET Core SignalR. How can we catch unhand...
Simon
0

votes
0

answer
5

Views

signalR - web socket connectionData: [] after connection start in ASP.Net MVC

My current application has an online voting process this was previously build feature using signalR older version - 1.1.4 & that online feature working perfectly in older version but later we did some .net version upgrade and we decide to upgrade signalR too. so we upgraded it to 2.0.3 to do this I...
TDM
1

votes
1

answer
237

Views

Does signalr create connection for each hub inside same app or all the hubs share same connection?

If the answer is each hub has its own connection , how expensive are really these connections, lets say we have 3 hubs for 30K user connected is there really a performance gain if I reduce them to one hub ?
sino
1

votes
1

answer
796

Views

autofac with signalr no parameterless constructor defined for this object

I'm using autofac on my current Asp project and everything works fine until i decided to use dependancy injection in a signalR Hub here's my startup class public partial class Startup { public void Configuration(IAppBuilder app) { ConfigureAuth(app); var builder = new ContainerBuilder(); builder.Re...
Ahmed Ali
1

votes
1

answer
201

Views

Why are we checking context.connectionId when a recconect in signalR occurs?

As I know, The OnReconnected event handler in a SignalR Hub can execute directly after OnConnected but not after OnDisconnected for a given client. (source: http://www.asp.net/signalr/overview/guide-to-the-api/handling-connection-lifetime-events) So, if onReconnected will never be happened after onD...
Dato Maisuradze
1

votes
1

answer
91

Views

Calling method of class in hub using SignalR

I have hub class with some methods, which are called by client without problems. But what to do, if I want to call method of class in hub's property, for example: Class MyHub Inherits Hub Sub HubMethod() End Sub Property SC As New SimpleClass End Class Class SimpleClass Sub DoNothing() End Sub End...
Ondřej
1

votes
2

answer
798

Views

Sending messages to groups using SignalR Core

This is my first implementation of SignalR and I'm starting with SignalR Core so some of the examples and documentation don't seem to apply to the new version. My objective is to send the received message to a particular chat room. I understand this could be achieved using Groups. First question: I'...
Sam
1

votes
1

answer
1.7k

Views

SignalR get groups user is in

I'm making a 1-to-1 chat application and I'm using groups for that. You join a group with Groups.Add(Context.ConnectionId, roomName). And whenever a message is sent, I want to call Clients.Group(roomName).addMessage(username, text); But for that I need a roomName variable. How do I retrieve the roo...
Tvde1
1

votes
0

answer
10

Views

SignalR client is not processing recieved data asynchronusly

my problem is the following: I have my ASP.NET WEB API Server (not Core) with basic SignalR functionality. Basically on Client connected I return multiple sets of data to the Client In my DataHub.cs public class DataHub : Hub { public override Task OnConnected() { Init(Context.ConnectionId); return...
Brian Seewod
1

votes
2

answer
284

Views

How to user IUserIdProvider in .NET Core?

This article describes using IUserIdProvider interface. It shows how you can use GlobalHost to make SignalR use you user ID provider. But SignalR for .Net Core does not have GlobalHost. What is the replacement?
user1476860
1

votes
1

answer
1.3k

Views

SignalR opens new connection for the same user

I am new to SignalR and trying to implement long running result pooling. I have added JS to my ASP.NET MVC app and created bug class. JS var message= $.connection.messageHub; $(function () { message.addMessage = function (htmlstring) { alert(htmlstring); }; $.connection.hub.start(functio...
Tomas
1

votes
2

answer
10.3k

Views

How to pass a parameter to hub in SignalR?

My code in SignalR hub: public class AlertHub : Hub { public static readonly System.Timers.Timer _Timer = new System.Timers.Timer(); static AlertHub() { _Timer.Interval = 60000; _Timer.Elapsed += TimerElapsed; _Timer.Start(); } static void TimerElapsed(object sender, System.Timers.ElapsedEventArgs e...
WinFXGuy
1

votes
1

answer
596

Views

SignalR - how to disable WebSockets (but keep other transports active)?

In both a C# client and Web Client - how do I tell signalR - 'Try everything but websockets'? I have the following in my web code: window.hubReady = $.connection.hub.start({ transport: 'longPolling' }); But this is just javascript and longpolling; I'm looking for the configuration for both JS and C...
SB2055
1

votes
1

answer
353

Views

is there any way to check if a connection id is alive?

I'm building a system with multiple SignalR instances, each of which is connected to a message bus. Given a connection id, is there any way to check if the connection id is alive? If not, what would be the best practice to do this on the server side? thanks
soleiljy
1

votes
2

answer
1.9k

Views

How to send the Group name on connected in SignalR Persisted Connection?

I have different groups of users to which i need to send data. I could have used hubs concept here but the only SignalR Android client library 'SignalA' https://github.com/erizet/SignalA doesnt have implementation for hubs so i had to use Persisted Connections and its group concept. Now i see this O...
Bitsian
1

votes
1

answer
105

Views

Is it possible to call client from codebase (server) without using another hub client?

Here is simple SignalR app example: https://github.com/SignalR/SignalR/wiki/QuickStart-Hubs I've got this class public class Chat : Hub { public void Send(string message) { // Call the addMessage method on all clients Clients.All.addMessage(message); } } But I don't create an object any...
Cynede
1

votes
1

answer
1.9k

Views

SignalR Hub connectivity from Windows Phone 8

What I'm trying should be basic; but must be missing something. Have couple of SignalR Hubs defined inside an MVC3 app running locally. Same solution has a Windows Phone 8 & a Windows Store app, both talking to the SignalR hubs for real-time communication. SignalR server uses latest bits & clients u...
Sam Basu
1

votes
1

answer
659

Views

signalr server hub error

I'm trying to create a server and a asp.net client (2 projects in one solution..). In the server in the class where the hub is defined i get an error ... I use visual studio 2013. this is the startup: using System; using System.Threading.Tasks; using Microsoft.Owin; using Owin; [assembly: OwinStartu...
user2958571
1

votes
2

answer
705

Views

HttpContext null in Signalr OnConnected method

I am using signalr, but facing an issue in the Onconnected method. I need urlreferrer here but I get a null pointer exception. public override Task OnConnected() { string urlreferrer = HttpContext.Current.Request.UrlReferrer.ToString(); // Getting null exception here.. return base.OnConnected(); }...
Umesh Sehta
1

votes
2

answer
322

Views

ASP .NET, MVC Razor - How to display image from script

I am using mvc4, Razor and SignalR. Now in my cshtml. i have and within the script i have $(function () { //code omitted // Reference the auto-generated proxy for the hub. var chat = $.connection.chatHub; chat.client.addfriend = function (name) { // Add the message to the page. $('#friends').append...
asb
1

votes
1

answer
739

Views

Calling a client method from C# code in Generic Handler, SignalR

I've the following Hub: public class ImageHub : Hub { public void LoadTheImage(String id, String imageUrl) { Clients.All.loadReadyImage(id, imageUrl); } } And the following JavaScript code on the client side. $(function () { var loadImage = $.connection.imageHub; loadImage.client.loadReadyImage = fu...
user3332579
1

votes
1

answer
73

Views

Groups.Add does not immediately add the caller into the group

I have the following code: public void JoinGroup(string groupName, string userFullName) { Groups.Add(Context.ConnectionId, groupName); // Send data back to everyone including the caller Clients.Group(groupName).dataChanged(...); } I would expect Clients.Group(groupName) to call back to the client...
GETah
1

votes
2

answer
2.2k

Views

Explicitly set multiple transports in SignalR .Net client

Is it possible to explicity set two (or more) transports in the SignalR .Net Client? I can set a single transport using code such as: _hubCn.Start(new LongPollingTransport()); In the Javascript client it can be done using: connection.start({ transport: ['webSockets','longPolling'] }); However I have...
Jon Egerton
1

votes
1

answer
764

Views

Manually create a group using SignalR

I have a list of userDetails connected to a hub and I am storing those users to List.I want to add some of the users to a Group and broadcast a message to that group. But I am not able to figure out how can I create a group.This is what I a have done so far: foreach(var user in userDetails) { Groups...
Vivek
1

votes
1

answer
6.5k

Views

SignalR 2.2.0 WebSocket error connecting to hub

I have an ASP.Net MVC application that I have added SignalR to. After following the 'Getting Started' tutorial (with modifications of course since it's going in my application) I got it working on localhost. However once it's in the production environment, I get the following error: WebSocket conn...
Bardicer
1

votes
1

answer
702

Views

Declaring a reference to hub proxy in SignalR

I am wondering... The following code declares a reference to a hub proxy. var chat = $.connection.chatHub; And the following code also: var connection=$.hubConnection(); var hub=connection.createHubProxy('chatHub'); So what is the difference between the two tpyes of declaration? Which one to be us...
KAL
1

votes
1

answer
858

Views

How to bind datatable having dynamic number of columns to Kendo UI Grid with SignalR?

I need to bind the Kendo Grid using SignalR with the Datatable that has dynamic number of columns. How can I achieve this. Can I directly pass the DataTable object from Hub to View? My code is as follows: View: @model System.Data.DataTable var TestGridHub = {}; $(function () { TestGridHub = $.connec...
giparekh
1

votes
1

answer
2k

Views

Handle onDisconnected() method of 1.x to SignalR 2.1.2

I had implemented signal R 1.1.3 version in Asp.Net-MVC project earlier, but now i need to update signal R version with the latest one and it is signal R 2.1.2, inside the signal R 2.1.2 the problem is that its not support onDisconnected() method in hub class. so can i handle Disconnection event of...
Anand Thakkar
16

votes
2

answer
14k

Views

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 (using the invoke) which works fine - then on the serve...
Marcel
17

votes
2

answer
7.4k

Views

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 decided to refactor the code. I realized that the...
pardahlman
17

votes
2

answer
12.1k

Views

“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 suitable method found to override' ChatHub class:...
Palindrome
1

votes
2

answer
1.4k

Views

Why does this work when I debug from Visual Studio but doesn't after I deploy to IIS?

Ok so this is really becoming frustrating and am hoping that someone can help me with this. I have just started going through some SignalR tutorials and all of that was working great. Then I decided to add an MVC Entity Framework model for some data access to my SignalR project so I could store name...
JosephN
17

votes
4

answer
16.1k

Views

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 has to be initialized as ReadOnly.' in the line R...
polonskyg
17

votes
2

answer
12.1k

Views

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
18

votes
4

answer
16.2k

Views

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 registers the ConnectionStringName in the HttpSession....
Lodewijk
1

votes
1

answer
16.3k

Views

SignalR long polling transport

I'm using SignalR 0.5.3 with hubs and I'm explicitely setting transport to long polling like this: $.connection.hub.start({ transport: 'longPolling' }, function () { console.log('connected'); }); with configuration like this (in global.asax.cs Application_Start method): GlobalHost.DependencyResolver...
yojimbo87
18

votes
1

answer
6.1k

Views

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 Hub? $.connection.hub.error(function() { return ale...
Brian Rosamilia
1

votes
1

answer
1.2k

Views

SignalR Hub's Groups dont work with long polling

I have a Web App(.NET 4.0 ASP.NET MVC3) which uses SignalR(1.0.0 alpha 2) with Hubs and Persistent Connections. With the Hubs I use groups to send push notifications to some clients. The problem is that when the server is accessed remotely it defaults to long pooling and only the persistent connecti...
Bond
4

votes
1

answer
2.5k

Views

Connect to SignalR Hub after connection start

Let's say i have two or more hubs in my server application. My javascipt client (Angular SPA) initialy needs a connection to the first hub, and needs to subscribe to a method like this: connection = $.hubConnection(appSettings.serverPath); firstHubProxy = connection.createHubProxy('firstHub'); first...
Jeroen1984
2

votes
1

answer
683

Views

What does the controller hub in Crank, the SignalR test tool, do?

I am using the latest version of SignalR and Crank. I want to use the standard switches to spin up multiple simulated clients. Thus: /NumClients:N and /ControllerUrl:URL. I don't understand why I have to specify the second option when I specify the number of clients, N. I see that a single 'control...
John Ratcliffe

View additional questions