signalr

ASP.NET core background service to send data through signalR

核能气质少年 提交于 2019-12-08 05:46:10
问题 I'm using signalR to send data to clients from server. What I want to is check data in the table(MSSQL DB) and send the related data to clients through signalR. So I want to create some background service to check database and send data. I planned to use System.Threading.Thread.Sleep(3000); with while(true) loop. How can I create service class to run this method in startup. Is there any method to use do this task in standard way?? 回答1: You can use an IHostedService and IHubContext to

SignalR and Reactive combo

萝らか妹 提交于 2019-12-08 05:42:05
问题 I found this little gem about how to get SignalR and Rx to play nicely: Rx and Reactive Tutorial However as you might have noticed this only works when going from server -> client. Does anyone know how to go the other way around? I want my framework to be a bit more "message" based like NServiceBus and less RPC (which signalr standard examples tend to be). The reason for this is the weakly typed world doesn't lend itself very well to RPC. On the server side I'd love to be able to put

Using StructureMap for dependency injection to SignalR 2.0.1

随声附和 提交于 2019-12-08 05:23:17
问题 I'm trying to use StructureMap for dependency injection to a SignalR hub. Many sources in the internet say this should be done as in this answer: How do you Resolve signalR v2.0 with StructureMap v2.6. I tried it, and got it to work - at least for the first action after the first pageload. When I try to leave the HTML page that includes the SignalR-JS-Code (or reload the page), or when I use one of the functions defined in my hub a second time, I get this StructureMapException: You cannot use

Asp.Net Core 2.0: Simple way to execute long running tasks and report progress?

喜欢而已 提交于 2019-12-08 05:20:48
问题 I have a page where the user can select multiple files and upload them. Once the files are buffered in the server, they are deserialized, and the object graphs are stored using Entity Framework Core 2 and SQL Server. All this happens within a controller action. The problem is that when the file is a little bit bigger, this collection of tasks can take about 5 minutes to complete, and because of that, I get a 502 error (probably a timeout). To solve this problem, I had the idea of reporting

Sharing SignalR hub with ASP.NET Website and a Web API Mobile Backend

旧街凉风 提交于 2019-12-08 05:17:10
问题 I've set up SignalR Realtime communication for my ASP.NET based website. However, I need to know if it's possible to share the same SignalR Hub with a separate Mobile Backend Project which deals with the same server and database. Basically like accessing the facebook's inbox through web and mobile at the same time? That would be a ASP.NET Web project and a Mobile Client connected to one hub. 回答1: If you want to find SignalR for Android , I suggest the following working link for your to start

SignalR and large number of groups

对着背影说爱祢 提交于 2019-12-08 05:06:36
问题 I'm using SignalR's latest version and it's great. However, I've recently hit an interesting scaling issue: it seems that SignalR sends all the client's groups from the client in the query string. My system requires that a person join numerous groups, which represent all the projects that the user is subscribed to, and receive notifications on any of them. this large number of groups (and me using GUIDs for ids) has caused the querystring to reach its maximum size, and SignalR to stop working

SignalR Updating TextArea realtime

浪尽此生 提交于 2019-12-08 05:02:34
问题 Hi i just started learning SignalR v2. I have a textarea in my aspx page and i want to update it in realtime whenever a user presses a key on it. Issue: I opened 2 tabs in my browser. If i type the first character example "a" , nothing happens: Tab1 textarea: "a" tab2 textarea: NOTHING Then i proceed to type the second character "b" Tab1 textarea: "ab" tab2 textarea: "a" Conclude: Its always not updating the latest character i typed! SignalR Class public class DocHub : Hub { public void

Angular 2 + SignalR - Accessing Angular internals from external script

谁都会走 提交于 2019-12-08 04:36:01
问题 I'm using SignalR with an Angular2 app, where we want the SignalR client methods to call into the Angular app with data received from the server, and then have Angular redo the data-bindings. For example, within the Angular app I expose a global variable for our store, which has a collection on it. E.g. (TypeScript) .... export class Store{ Customers : Customer[]; constructor(){ window["GlobalStore"] = this; } setCustomers (customers : Customer[]){ this.Customers = customers; } } .... and in

SignalR change DisconnectTimeout when using custom resolver

我只是一个虾纸丫 提交于 2019-12-08 04:13:31
问题 I'm using a custom resolver when running SignalR to make use of dependency injection. But it seems like my DisconnectTimeout & KeepAlive values aren't used after this. I've read some comments that the Configuration is ignored then using a custom resolver. But settings the GlobalHost.DependencyResolver should do the trick. But after changing it, the disconnect timeout still seems to be 30 seconds.. Code: var resolver = new NinjectSignalRDependencyResolver(Program.kernel); GlobalHost

Get names of Online users connected to a Server

我怕爱的太早我们不能终老 提交于 2019-12-08 03:56:40
问题 I am new to asp.net. I have gone through this link which has shown how to count the online users connected to a server using asp.net. ( which is working when I tried ) My question is: What should I change in that code (Global.asax) so that It shows all the names of the connected users instead of counting them. I created a chat application which stores the name of the connected user in a variable chatUsername in js file as shown below: js file var chatUsername = window.prompt("Enter Username:"