简体   繁体   English

一对一聊天使用 asp.net 核心 SignalR 和 angular 2

[英]Chat one to one using asp.net core SignalR and angular 2

在此处输入图像描述 在此处输入图像描述 Here i called the method into my SignalR Hub Class to brodcast messages to user.i did another method for to send messages to all connected users but now i want to sendand receive messages between two user在这里,我将该方法调用到我的 SignalR 集线器 Class 中以向用户广播消息。我做了另一种方法来向所有连接的用户发送消息,但现在我想在两个用户之间发送和接收消息

Create groups创建组

Add a client to a group:将客户端添加到组:

Groups.AddAsync("YourGroupId", Context.ConnectionId); 

Remove client from group:从组中删除客户端:

Groups.RemoveAsync("YourGroupId", Context.ConnectionId); 

Send message to a group:向群组发送消息:

Clients.Group("").MethodOnYourClient("");

Remark: I suggest you to read the tutorial: https://docs.microsoft.com/en-us/aspnet/signalr/overview/getting-started/tutorial-getting-started-with-signalr备注:建议您阅读教程: https://docs.microsoft.com/en-us/aspnet/signalr/overview/getting-started/tutorial-getting-started-with-signalr

I know it's not with asp.net core signalr, but the most of the stuff looks similar.我知道它不是 asp.net 核心 signalr,但大多数东西看起来都相似。 Maybe you have to show in intellisense which possibilities the existing classes have.也许您必须在智能感知中显示现有类具有哪些可能性。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 使用SignalR作为独立的服务器应用程序,而不是Asp.Net - Using SignalR as a standalone server application, and not an Asp.Net one 如何在ASP.NET Core Angular应用中使用SignalR Stream? - How to use SignalR Stream in ASP.NET Core Angular app? 在 Asp.Net Core 应用程序中一次使用一个角色 - Using one role at once in Asp.Net Core application 在我的简单 xamarin 聊天应用程序中无法连接到 ASP.NET Core SignalR - Can't connect to ASP.NET Core SignalR in my simple xamarin chat app 在 SignalR ASP.NET Core 3.0 中使用 IAsyncEnumerable 尝试捕获 - Try Catch using IAsyncEnumerable in SignalR ASP.NET Core 3.0 在没有 ASP.Net Core 服务器的情况下使用 SignalR - Using SignalR Without an ASP.Net Core Server 如何在 Asp.net Core 中使用 SignalR 向组发送通知 - How send notification to groups using SignalR in Asp.net Core 使用signalr和sqldependency在asp.net核心中进行数据库更改通知 - Database change notifications in asp.net core using signalr and sqldependency 在 .NET 控制台客户端应用程序中使用 ASP.NET Core SignalR 从 Azure SignalR 接收消息 - Using ASP.NET Core SignalR in .NET Console Client App to Receive Messages from Azure SignalR Asp.Net Core中的SignalR配置 - SignalR configuration in Asp.Net Core
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM