asp.net-core-signalr

SignalR call client methods from outside the Hub class AspNetCore

≯℡__Kan透↙ 提交于 2019-12-18 09:19:09
问题 I'm trying to call client methods outside the hub on SignalR, the link below shows how to do this in the old version, although i'm unsure how to do this in the SignalR ASP.NET Core version. I've found a reference to a old post and using a reference to Microsoft.AspNetCore.SignalR.Infrastructure.IConnectionManager although this namespace doesn't seem to existing anymore. An example would be great? Old version: How to call client methods and manage groups from outside the Hub class 回答1: You

SignalR no transport

岁酱吖の 提交于 2019-12-13 20:28:43
问题 Attempting to start signal-r hub reports "Error: No available transports found." However, a diagnostic capture shows that negotiation returns three available transports. { "connectionId": "IsHpe_1ETRLz-flnJ3uKPg", "availableTransports": [ { "transport": "WebSockets", "transferFormats": [ "Text", "Binary" ] }, { "transport": "ServerSentEvents", "transferFormats": [ "Text" ] }, { "transport": "LongPolling", "transferFormats": [ "Text", "Binary" ] } ] } This is done with aspnetcore 2.1 preview2

Response to preflight request doesn't pass access control check: The value of the 'Access-Control-Allow-Credentials' header in the response is ''

我们两清 提交于 2019-12-11 15:42:04
问题 I, am using the SignalR features on angular 6 and asp.net core. But keep getting this error Response to preflight request doesn't pass access control check: The value of the 'Access-Control-Allow-Credentials' header in the response is '' which must be 'true' when the request's credentials mode is 'include'. Did some research and found that it is CORS issue from the server side.So modified the server code. startup.cs public void ConfigureServices(IServiceCollection services) { services.AddCors

constructor with parameters in a signalr-core hub

南笙酒味 提交于 2019-12-11 08:45:53
问题 I would like to inject something into my hub. Basically I am trying to the equivalent of this tutorial https://docs.microsoft.com/en-us/aspnet/signalr/overview/advanced/dependency-injection, but for SignalR-Core. I am mostly interested in the part public void Configuration(IAppBuilder app) { GlobalHost.DependencyResolver.Register( typeof(ChatHub), () => new ChatHub(new ChatMessageRepository())); App.MapSignalR(); // ... } How do I do this Net Core and SignalR-Core? 回答1: Register your

WebSockets don't work with SignalR Core when deployed to Prod

空扰寡人 提交于 2019-12-11 06:41:52
问题 ASP.NET Core 2.1 running behind IIS 8.5 SignalR doesn't seem to negotiate a Sub-Protocol when connecting and fails to complete the connection. Messages sent from the client to the server are never received. I can't configure the site to serve from Kestrel directly as this is a shared server. Changing the transport to long-polling works. I have tried disabling HTTPS/HSTS redirection. Attached are the logs from the client and the server: Client logs : Information: Normalizing 'hubs/screen' to

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

Realtime notification not sent

点点圈 提交于 2019-12-11 03:52:08
问题 I am trying to display realtime notification in ASP.NET Boilerplate, but it is not sent. public override async Task<MessagesDto> Create(MessagesCreateDto input) { var MessagesCore = ObjectMapper.Map<MessagesCore>(input); MessagesCore.UserId = Convert.ToInt32(AbpSession.UserId); MessagesCore.CreationId = Convert.ToInt32(AbpSession.UserId); MessagesCore.FromUserId = Convert.ToInt32(AbpSession.UserId); MessagesCore.CreationTime = DateTime.Now; MessagesCore.LastModificationId = Convert.ToInt32

How to check success of HubConnection.StartAsync in SignalR for ASP.NET Core 2.0?

ぃ、小莉子 提交于 2019-12-11 00:19:04
问题 Using SignalR for ASP.NET Core 2.0, Client side (1.0.0-alpha2-final), C# VS2017. To connect the code is: await hubConnection.StartAsync(); since this is an await for a void how can we test if the client did manage to connect ? In my tests I have a breakpoint on the server side in public override async Task OnConnectedAsync() but that breakpoint is not always hit therefore I know that sometimes the client does not connect. Or perhaps it did connect but OnConnectedAsync() was not triggered? How

ASP.NET CORE 2.1 Server timeout while debugging

核能气质少年 提交于 2019-12-10 02:21:07
问题 'Error: Server timeout elapsed without receiving a message from the server.'. I'm trying to debug some server-side code and while I do that the client gets disconnected in less than a minute. I'm only using SignalR to communicate to clients, without controllers yet. Is there any setting that can disable timeout or at least make it way longer than it is now? my launchSettings.json: { "iisSettings": { "windowsAuthentication": false, "anonymousAuthentication": true, "iisExpress": {

How to buffer messages on signal hub and send them when the right client appears?

风格不统一 提交于 2019-12-08 07:52:45
问题 I hawe two type of clients connecting my signalR server (ASP.NET Core). Some of them are senders, and some of them are receivers. I need to route messages from senders to the receivers, which is not a problem, but when there is no receivers, I need to somehow buffer messages and not lose them (probably the best is ConcurrentQueue in some kind of a singleton class) but when the first receiver connect, the message buffer needs to start dequeue. Which is the best approach for this? I created