signalr

Using signalR in asp.net core, how do I change the userID convention to use the users email address instead of default userId?

心已入冬 提交于 2021-02-20 04:01:36
问题 Im using <PackageReference Include="Microsoft.AspNetCore.SignalR.Core" Version="1.1.0" /> in an asp.net core web api. I can see by default that if I want to send a specific user a message I can call a method such as _hub.Clients.User("c5MOTEmXsEZjoVf-y_sVQD_g-yBis9fvLMbyNJX3M31").SendAsync("MessageUpdated", "ee"); However, I would like to know, is there any way to change this such that I can instead pass in a different value for the userId? For example, users email address instead? Is this

Using signalR in asp.net core, how do I change the userID convention to use the users email address instead of default userId?

谁说胖子不能爱 提交于 2021-02-20 04:00:53
问题 Im using <PackageReference Include="Microsoft.AspNetCore.SignalR.Core" Version="1.1.0" /> in an asp.net core web api. I can see by default that if I want to send a specific user a message I can call a method such as _hub.Clients.User("c5MOTEmXsEZjoVf-y_sVQD_g-yBis9fvLMbyNJX3M31").SendAsync("MessageUpdated", "ee"); However, I would like to know, is there any way to change this such that I can instead pass in a different value for the userId? For example, users email address instead? Is this

Connection.Start().Done() SignalR Issue

独自空忆成欢 提交于 2021-02-19 05:07:31
问题 I am designing a real-time document editor web application similar to google docs using SignalR connections. It is working ok i.e. when I am writing in one editor in a browser, text is being displayed on the other open browsers I have. The only problem I have is that when at first I write some text it is not being displayed, then I delete and write again and everything is ok. When I debug using F12 in Chrome I am getting this error: Uncaught Error: SignalR: Connection has not been fully

Connection.Start().Done() SignalR Issue

£可爱£侵袭症+ 提交于 2021-02-19 05:06:23
问题 I am designing a real-time document editor web application similar to google docs using SignalR connections. It is working ok i.e. when I am writing in one editor in a browser, text is being displayed on the other open browsers I have. The only problem I have is that when at first I write some text it is not being displayed, then I delete and write again and everything is ok. When I debug using F12 in Chrome I am getting this error: Uncaught Error: SignalR: Connection has not been fully

SignalR - Call statically typed hub from Context

ε祈祈猫儿з 提交于 2021-02-19 01:37:32
问题 I'm trying to figure out how to invoke a method on a strongly typed hub from the server. I'm using .Net-Core 2.0 I have a stongly typed hub interface: public interface IMessageHub { Task Create(Message message); } and a hub which looks like so: public class MessageHub: Hub<IMessageHub> { public async Task Create(Message message) { await Clients.All.Create(message); } } Normally on the server I might push content to the client like so: [Route("api/[controller]")] public MessagesController :

SignalR - Call statically typed hub from Context

落花浮王杯 提交于 2021-02-19 01:37:05
问题 I'm trying to figure out how to invoke a method on a strongly typed hub from the server. I'm using .Net-Core 2.0 I have a stongly typed hub interface: public interface IMessageHub { Task Create(Message message); } and a hub which looks like so: public class MessageHub: Hub<IMessageHub> { public async Task Create(Message message) { await Clients.All.Create(message); } } Normally on the server I might push content to the client like so: [Route("api/[controller]")] public MessagesController :

.Net Webapi SignalR与微信小程序的交互

左心房为你撑大大i 提交于 2021-02-13 13:55:40
.Net Webapi S ignal R 与微信小程序 的交互 一、SignalR与Webapi 1、SignalR的安装: Signalr与跨域仅需要安装两个开源库 Microsoft.Owin.Cors是配置跨域需要使用到的库。 2、SignalR的配置 需要新建一个 Startup.cs文件来编写配置代码,我是建在App_Start文件夹里,与其他配置文件统一放置一起。 Configuration的配置不仅限于如此配置,也可以自定义,如: 3、Hub与Webapi的整合 创建 Webapi父类,继承ApiController。则可以在需要使用Hub实时推送消息的api中继承这个父类,便可以直接使用Clients或Groups推送消息。简单来讲,就是可以通过Webapi进行signalr的消息推送。 4、Hub的创建与事件 直接在新建项中便可以创建对应的类文件。 在新建的文件中需要重写 Hub的几个事件: 这 3个事件都可以在其中进行业务处理。 在这个集线器中还可以定义推送消息的方法,后面在 Web中可以直接调用。 二、SignalR与Web 当安装 SignalR的时候,signalr会自带创建了Script文件夹(如还没有改文件夹的话),里面会新增一些js文件: 在 Web的调用中,就会使用到jquery.signalR-2.0.0.js。这里简单介绍一下使用即可

SignalR CORS same origin policy?

廉价感情. 提交于 2021-02-11 16:27:50
问题 When I run my angular app I get a CORS, although I've enabled it in my .NET core app, regular http requests seem to work fine, it's just with SignalR I'm having issues. Any suggestions would be much appreciated. Thanks in advance. Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://localhost:5001/api/chat/negotiate. (Reason: expected ‘true’ in CORS header ‘Access-Control-Allow-Credentials’). Cross-Origin Request Blocked: The Same Origin Policy

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

梦想与她 提交于 2021-02-11 13:12:49
问题 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

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

安稳与你 提交于 2021-02-11 13:12:16
问题 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