signalr

What Is The Correct Way of Closing / Disconnecting An ASP.NET Core signalR Client Connection?

≯℡__Kan透↙ 提交于 2021-02-11 13:12:06
问题 I am a new user struggling to close a secondary signalR client gracefully from an ASP.NET Core Blazor Server Page. I am setting up a secondary signalR client connection on first render of a Blazor Server Page. I am trying to close this secondary signalR client connection when the Page is closed via the browser tab. At the time of writing DisposeAsync does not seem to be triggered when the page is closed via the browser tab. However, the Dispose method IS triggered. Furthermore in Safari 13.0

SignalR 2, Autofac, OWIN WebAPI will not pass message from server to hub

天大地大妈咪最大 提交于 2021-02-11 13:10:12
问题 I have tried several variations over the past several weeks and so far all I can do is pass a message from the UI to the server and back. I am unable to pass a message from my controller or other method outside the hub to the UI. It seems like I am not getting an instance of the HubContext. I've created a basic demo app from scratch and uploaded here: https://github.com/cdecinkoKnight/SignalRDemo-help I have a basic hub (MessageHub): [HubName("messages")] public class MessageHub : Hub,

SignalR 2, Autofac, OWIN WebAPI will not pass message from server to hub

牧云@^-^@ 提交于 2021-02-11 13:10:05
问题 I have tried several variations over the past several weeks and so far all I can do is pass a message from the UI to the server and back. I am unable to pass a message from my controller or other method outside the hub to the UI. It seems like I am not getting an instance of the HubContext. I've created a basic demo app from scratch and uploaded here: https://github.com/cdecinkoKnight/SignalRDemo-help I have a basic hub (MessageHub): [HubName("messages")] public class MessageHub : Hub,

SignalR Connection Limitation for .NET Client

蹲街弑〆低调 提交于 2021-02-11 06:30:51
问题 I made an experimental solution which includes WebMvc (SignalR Client) -> (SignalR Hub) WebApi. Each time new user connects to WebMvc web site then it creates new Hub connection to WebApi. It means that if 10K users connect to web site then WebMvc will create 10K connections to SignalR Hub. Are there any connection limitations for WebMvc application? 回答1: The maximum number of concurrent connections depends on your settings. For SignalR, the limitation depends on your IIS Configuration for:

javascript xmlhttp error on signalr in asp.net core

柔情痞子 提交于 2021-02-10 22:22:20
问题 In my application 2 projects and mvc client run at port(5002) and web api project run at port (5001). I have implemented signalr in mvc client. Now showing error log in console as below: and i have also added configuration to my api project for core policy like: services.AddCors(options => { options.AddPolicy("signalr", builder => { builder.WithOrigins("https://localhost:5002") .AllowAnyHeader() .AllowAnyMethod(); }); }); And now also showing same error. Please suggest. 回答1: You need to

Xamarin - SignalR Hanging on connect

岁酱吖の 提交于 2021-02-10 20:29:13
问题 I'm trying to connect my Xamarin app to my SignalR backend which is hosted on Azure. The issue I'm having is every time I call StartAsync() on my HubConnection it just hangs the client and the request is never completed. I have tried break pointing through the app to make sure this is actually where the hang is happening. I have tried using the exact same code on an ASP.Net Core project to confirm the SignalR connection is working, which it is, I can connect and send commands successfully. I

Xamarin - SignalR Hanging on connect

≡放荡痞女 提交于 2021-02-10 20:28:28
问题 I'm trying to connect my Xamarin app to my SignalR backend which is hosted on Azure. The issue I'm having is every time I call StartAsync() on my HubConnection it just hangs the client and the request is never completed. I have tried break pointing through the app to make sure this is actually where the hang is happening. I have tried using the exact same code on an ASP.Net Core project to confirm the SignalR connection is working, which it is, I can connect and send commands successfully. I

How to send Parameter/Query in HubConnection SignalR Core 2.1

为君一笑 提交于 2021-02-10 14:50:32
问题 I'm trying to send parameters into connection to signalr Connection = new HubConnectionBuilder() .WithUrl("https://familyapp.azurewebsites.net/StoreHub?token=123") .Build(); await Connection.StartAsync(); In my server side i take this parameter from HttpContext: public override async Task OnConnectedAsync() { var group = Context.GetHttpContext().Request.Query["token"]; string value = !string.IsNullOrEmpty(group.ToString()) ? group.ToString() : "default"; await Groups.AddToGroupAsync(Context

How can I close the client-side JavaScript 'Hub' connection in SignalR?

坚强是说给别人听的谎言 提交于 2021-02-10 13:16:57
问题 I have followed this tutorial. But there is no hint how to close the Websocket connection via the HubConnection class in signalr.js -file. The file is V1.0.4. This solution does not resolve my problem because I am using the microsofts javascript-library. Here ist the code: var lHubConnection = null; var Init = function () { // create instance lHubConnection = new signalR.lHubConnectionBuilder().withUrl("/chatHub").build(); // receive message lHubConnection.on("ReceiveMessage", function

How to pass a parameter to hub in SignalR?

☆樱花仙子☆ 提交于 2021-02-09 08:27:34
问题 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) { //Random rnd = new Random(); //int i = rnd.Next(0,2); Alert alert = new Alert(); i = alert.CheckForNewAlerts(EmpId); var hub = GlobalHost.ConnectionManager.GetHubContext("AlertHub"); hub