signalr

Hub.start - wait for finish

纵饮孤独 提交于 2019-12-11 06:39:39
问题 I'm using SignalR to transferring commands from client to server without refreshing the page. When the client enter some of my web pages, I'm starting a new hub connection. Like this: var hub = $.connection.siteControllerHub; $.connection.hub.start(); This "start()" function takes some time (+-5 seconds). mean while, the page is already finished loading and the user start using my UI. SingalR cannot serve the user, until it's finish loading the connection. I'm know that I'm can use the async

Can I get SignalR to not disconnect itself when settings window location?

瘦欲@ 提交于 2019-12-11 06:24:09
问题 I am writing a simple page that listens to SignalR events that once detected will perform an ajax request to a web service on our servers. Once that ajax request is complete, a url is returned with a custom URI scheme that once reirected to, will open up a custom program installed on the client machine without navigating away from the main page. This is achieved by calling window.location = url; in the success callback of the ajax request. This method works find on the other areas of our

How to get the AspNet Core SignalR Transport Protocol in the Hub?

人盡茶涼 提交于 2019-12-11 06:16:41
问题 In the old SignalR, you could do this to get the transport in the Hub on the Server: Context.QueryString["transport"]; But in the new SignalR, written for AspNet Core, I couldn't find where the Transport Protocol can be found within the Hub on the Server. Can it be found? If so, where? 回答1: As of ASP.NET Core SignalR 1.0.0-rc1-final (commit), you can get the TransportType from: // using Microsoft.AspNetCore.Http.Connections.Features; var transportType = Context.Features.Get

Keep running one task every time Signalr Hub class is called

倾然丶 夕夏残阳落幕 提交于 2019-12-11 05:33:46
问题 I want to monitor CPU performance on my ASP.NET MVC5 application and users are able to select the PC they want to be monitored. I use SignalR for monitoring real time CPU performance. It works well for first CPU, the problem is once user select another PC to be monitored, another new Task according to this link will be created so that both of the previous and new Task will sent their data to the client chart. What is the solution for handling my problem so that once user change the PC just

Does SignalR Server Sent Events implementation occupy thread for each connection?

对着背影说爱祢 提交于 2019-12-11 05:05:17
问题 When I use signalR which falls back to ServerSentEvents, and I can see on fiddler an open connection to the server waiting for chunked data, does it mean a thread is being occupied on the server at this time? If so, it is not quite efficient as far as I see it.. For example I would not write such code in the server that blocks a thread: public ActionResult ServerSentEvents { DateTime currentdate = DateTime.Now; Response.ContentType = "text/event-stream"; while (currentdate.AddMinutes(1) >

SignalR2 OnConnected not working as per documentation

大憨熊 提交于 2019-12-11 04:30:10
问题 Below is the code I wrote for SignalR implementation based on ASP.Net documentation and I use manual proxy creation method. I Could see only negotiate happening and received a Connection id. I can't see OnConnected method in my hub gets executed when I start connection. According to the note section in the document I have attached event handler before I call start method SignalR Hub public class MyTestHub: Hub { private static Dictionary<int, List<string>> userConnections = new Dictionary<int

Angular C# WebAPI SignalR:- Error loading hubs. Ensure your hubs reference is correct

柔情痞子 提交于 2019-12-11 04:26:27
问题 Duplicate of Error loading hubs. Ensure your hubs reference is correct, e.g. <script src='/signalr/js'></script> But no answer yet. Please help. 回答1: Mine was a stupid mistake! Hope this might help others in future. I have AngularJS front end and C# Web API back end. So my routing was in Angular and Web API had a routing to make sure that angular does all the routing. So in my Global.asax file, the code was as follows string url = Request.Url.LocalPath; if (!System.IO.File.Exists(Context

Can I debug OnConnected method in SignalR Hub?

拥有回忆 提交于 2019-12-11 04:19:17
问题 I have a Hub inside my asp.net project , and I overridden the OnConnected method, can I debug the code inside the OnConnected method? I put a breakpoint but it's not firing. public class ConsultasHub : Hub { public override Task OnConnected() { //breakpoint here //some code //[...] return base.OnConnected(); } } } 回答1: This is a tricky one. By design, if you don't have any subscriptions to the hub, then the client can't get any messages from server so the OnConnected won't get called. I tried

Send message to specific client as well as the message sent user

拈花ヽ惹草 提交于 2019-12-11 04:02:48
问题 I am beginner in SignalR. I created a basic chat application based on SignalR. The problem I am facing is that I want to send message to the specific client as well as the user who sent the message. How to do this? I know that to send a message to a specific client we can do this: Clients.Client(Context.ConnectionId).addMessage(data); which only sends message to the specified client not the one who sent the message. I can even append the message at the user itself using jQuery giving a false

Signalr client to retrieve missed messages on reconnect

梦想的初衷 提交于 2019-12-11 03:56:48
问题 I would like a user to retrieve messages that they may have missed when they re-connect to the Signalr server. I know I could persist the messages independently of Signalr, keep track of the last message id received in the client and resend the newer messages on reconnect but I was looking at the SqlServer backplane's Messages_0 table which has a Payload and PayloadID and was wondering if there is a more Signalr'y way to get the backplane to do this for me or to extend the backplane to do