asp.net-core-signalr

SignalR Core not using Websockets in Azure App Service

*爱你&永不变心* 提交于 2020-06-26 04:28:24
问题 I'm working on a SignalR Core web app that uses the following stack: ASP.NET Core 2.1 preview 2 (2.1.0-preview2-final) SignalR Core 1.0 preview 2 (1.0.0-preview2-final) Microsoft.AspNetCore.Cors (2.1.0-preview2-final) Microsoft.AspNetCore.WebSockets (2.1.0-preview2-final) The client is using SignalR NPM package (@aspnet/signalr). The app is configured like so: public void ConfigureServices(IServiceCollection services) { services.AddCors(options => { options.AddPolicy( "CorsPolicy", builder =>

How to use SignalR on Flutter?

霸气de小男生 提交于 2020-06-24 11:48:37
问题 Hi guys I'm trying to communicate with an Asp.Net core 2.1 application that uses SignalR to establish its chat communications, but I can't figure out what's the best way to accomplish that using flutter. I've searched for some library to do that, but the one that I found was not compatible with Flutter, just with Dart web as it uses the original SignalR.js to wrap the methods. Do you guys have any tips on how to accomplish that task ? 回答1: I just created a Flutter client for SignalR (ASP.NET

How to send a message to specific user using aspnetcore signalR?

两盒软妹~` 提交于 2020-04-17 22:52:28
问题 I have a requirement to send notification to specific user. I am using dotnet core 3.1. ASPNETCORE signalR for the notification. I am able to send the messages to all clients but unablt to do so for specific user. EDIT 1 My Hub looks like : public class NotificationHub : Hub { public override async Task OnConnectedAsync() { await Groups.AddToGroupAsync(Context.ConnectionId, Context.User.Identity.Name); await base.OnConnectedAsync(); } public override async Task OnDisconnectedAsync(Exception

How can I listen postgresql database with SignalR Core in .net core project?

。_饼干妹妹 提交于 2020-01-22 16:35:08
问题 I'm working on .net core web application. I want to listen my PostgreSQL database. And if there are any changes on table, I have to got it. So according to my research, I have to use SignalR Core. I did some example application with SignalR like chat app but none of them listen database. I couldn't find any example for this. -Does It have to be trigger on PostgreSQL database? -Does It have to be listener on code side? -How can I use SignalR Core? Please show me a way. Thanks a lot. 回答1: This

Access DB context through SignalR Core

女生的网名这么多〃 提交于 2020-01-21 09:19:25
问题 I'm using AspNetCore.SignalR and I need advice on how to access my SQL Server database through my Hub. There are not a lot of resources out there about this. I know how to add a singleton but I do not know how to access it later. How can I access a DB context that is defined using a Configuration.GetConnectionString in Startup.cs inside my Hub's Tasks? Thanks. Here's the relevant code: Startup.cs public void ConfigureServices(IServiceCollection services) { services.Configure

AspNetCore.SignalR : Cannot start a connection that is not in the Initial state

北城余情 提交于 2020-01-13 13:05:47
问题 I have troubles to get my ASP.NET Core SignalR app working. I have this server-side code : public class PopcornHub : Hub { private int Users; public async Task BroadcastNumberOfUsers(int nbUser) { await Clients.All.InvokeAsync("OnUserConnected", nbUser); } public override async Task OnConnectedAsync() { Users++; await BroadcastNumberOfUsers(Users); await base.OnConnectedAsync(); } public override async Task OnDisconnectedAsync(Exception exception) { Users--; await BroadcastNumberOfUsers(Users

AspNetCore.SignalR : Cannot start a connection that is not in the Initial state

别说谁变了你拦得住时间么 提交于 2020-01-13 13:05:15
问题 I have troubles to get my ASP.NET Core SignalR app working. I have this server-side code : public class PopcornHub : Hub { private int Users; public async Task BroadcastNumberOfUsers(int nbUser) { await Clients.All.InvokeAsync("OnUserConnected", nbUser); } public override async Task OnConnectedAsync() { Users++; await BroadcastNumberOfUsers(Users); await base.OnConnectedAsync(); } public override async Task OnDisconnectedAsync(Exception exception) { Users--; await BroadcastNumberOfUsers(Users

AspNetCore.SignalR : Cannot start a connection that is not in the Initial state

瘦欲@ 提交于 2020-01-13 13:04:08
问题 I have troubles to get my ASP.NET Core SignalR app working. I have this server-side code : public class PopcornHub : Hub { private int Users; public async Task BroadcastNumberOfUsers(int nbUser) { await Clients.All.InvokeAsync("OnUserConnected", nbUser); } public override async Task OnConnectedAsync() { Users++; await BroadcastNumberOfUsers(Users); await base.OnConnectedAsync(); } public override async Task OnDisconnectedAsync(Exception exception) { Users--; await BroadcastNumberOfUsers(Users

How to send Parameter/Query in HubConnection SignalR Core

别说谁变了你拦得住时间么 提交于 2020-01-12 07:00:24
问题 I'm trying to add parameter into connection to signalr. I'm using Builder to create my Client connection and start it: var connection = new HubConnectionBuilder() .WithUrl("http://10.0.2.162:5002/connection") .WithConsoleLogger() .WithMessagePackProtocol() .WithTransport(TransportType.WebSockets) .Build(); await connection.StartAsync(); I want to send a simple parameter in this connection: Something Like: "Token": "123" In my server side i think i can take this parameter from HttpContext:

How do you get a reference to an ASP.NET Core SignalR hub context outside of a controller?

社会主义新天地 提交于 2020-01-06 06:03:45
问题 I have just started using SignalR for ASP.NET Core. I have used SignalR for ASP.NET for a couple of years. I am using: Microsoft.AspNetCore.All 2.0.7 Microsoft.AspNetCore.SignalR 1.0.0-preview2-final Microsoft.AspNetCore.SignalR.Client 1.0.0-preview2-final It appears that in the ASP.NET Core version of SignalR I can no longer use GlobalHost or IConnectionManager to get a reference to a hub context. I can use DI to get a reference to the hub context in a controller without any problems. public