signalr-hub

Best use of SignalR Hub

青春壹個敷衍的年華 提交于 2019-12-24 19:51:44
问题 In my app, I have different parts, like Products, People, Suppliers, etc that they are entities which I defined as a Table in Db, and each part has separated page and its own logic for instant client update according to the Database changes. Also, I have some general rules for sending messages to Users and Groups. In this application, users can chat with them. However, I really can't decide how should I implement these in my application? How many hubs do I need? Single hub and different

Multiple SignalR hubs with different configurations

我怕爱的太早我们不能终老 提交于 2019-12-24 10:48:02
问题 I've run into a situation where I need multiple SignalR hubs (at least 2) with different configurations. Currently with v1.1.0 I can only do things like the following which configures all hubs: GlobalHost.Configuration.ConnectionTimeout = TimeSpan.FromSeconds(30); Is it possible to set different configurations for multiple hubs? 回答1: All hubs share the same connection object therefore they all share the same configuration. If you want to have 1 server but multiple connection configurations

Can SignalR be used without a web browser client?

房东的猫 提交于 2019-12-24 05:19:21
问题 I'm working on a project to front an asynchronous process with a synchronous front-end to make the web call appear as synchronous, and am exploring the use of SignalR to tie it all together. We host a service with a WCF endpoint which is asynchronous, and that works for most of our clients. They send us data, and we process it, without them getting a response after that data is processed. Our environment is multi-tier, and asynchronous by design. There is a need, however, to host a

Using generic methods on SignalR Hub

孤街浪徒 提交于 2019-12-23 12:54:28
问题 I'm creating a Hub class for my SignalR server and wanted to use a generic method which will save me from tons of lines of code. But SignalR is giving me errors when I try to Invoke the server code below from a Xamarin.iOS client which also in C#. Server Code public List<T> SendDataToClient<T>() where T : BusinessEntityBase { return SomeDBManager.GetItems<T>(); } Client Code var list = await hubProxy.Invoke<List<Article>>("SendDataToClient"); Am I doing something wrong here or is it just

different connection in Browser multiple tabs

杀马特。学长 韩版系。学妹 提交于 2019-12-23 10:25:22
问题 Why SignalR is making different connection in browser multiple tabs for same logged-in user. Is there any way to make one connection for all tabs opened in same browser. From connection I mean connectionID of a user in SignalR. 回答1: Because different tabs of the same browser are different documents\"processes" - each tab in some sense represents different "instance" of client app. There is no way to share JavaScript objects between them directly (and thats the reason why SignalR opens new

SignalR Groups not getting data

断了今生、忘了曾经 提交于 2019-12-22 20:41:09
问题 Hi I am having a problem where my signalR clients who are in a group do not get the information sent. I have tried this in two ways and both not working. On web page loaded the client will call the server to get the group name and then call a method on the hub to join the user in that group. JavaScript..... var connectionOpen = false; var myHub; $(function () { myHub = $.connection.myHub; myHub.client.showMessage = alertMessage; $.connection.hub.start(function () { connectionOpen = true;

Passing JWT Token as QueryString to SignalR Hub

会有一股神秘感。 提交于 2019-12-22 18:40:29
问题 Trying to follow the suggestions in the link below to pass a JWT token to my SignalR hub but so far it's not working. In particular, see David Fowler's suggestion on July 22, 2017. https://github.com/aspnet/SignalR/issues/130 My frontend is React so I'm simply adding the token to the querystring as follows where _token has my JWT token value: const connection = new signalR.HubConnectionBuilder() .withUrl("/myhub?AUTHORIZATION=" + _token) .configureLogging(signalR.LogLevel.Information) .build(

SignalR IAssemblyLocator override not firing

坚强是说给别人听的谎言 提交于 2019-12-22 18:36:47
问题 I have a simple app which uses several hubs, some in the same project and one in another class library, and everything is working fine. Now I want to try and load a hub that's been created at run-time using CSharpCodeProvider.CompileAssemblyFromSource, and have my client communicate with that hub. It's not showing up in /signalr/hubs/. As one of several things I'm trying to get working, I'm trying to use a custom IAssemblyLocator as described here: https://github.com/SignalR/SignalR/wiki

Call Signalr method from Controller .Net Core 2.1

让人想犯罪 __ 提交于 2019-12-22 09:28:36
问题 I am trying to call a method in the signalr Hub class from an (ASP.NET Core) MVC Controller, but I cannot find an example online that shows how to. Note: There are lots of examples using older versions of signalr with the .Net Framework, but none that I can see that show how to do this in .Net Core. I need to pass an id from the an MVC Action Result directly through to my Hub, without passing the id to the page, and then having to get a client connection back through to the hub. public class

Notify SignalR Server On Client Disconnected Accidentally (Disgracefully)

假如想象 提交于 2019-12-21 22:32:59
问题 I am setting my GlobalHost Configuration like this by following this answer to listen when the client is unreachable : GlobalHost.Configuration.ConnectionTimeout = TimeSpan.FromSeconds(50); GlobalHost.Configuration.DisconnectTimeout = TimeSpan.FromSeconds(30); GlobalHost.Configuration.KeepAlive = TimeSpan.FromSeconds(10); And Overriding the OnDisconnected method in my HUB Class to set the client has been disconnected public override Task OnDisconnected(bool stopCalled) { /*My code for saving