【发布时间】:2021-11-07 19:36:33
【问题描述】:
我有一个 ABP.IO v4.4.2 项目(.NET Core / Angular / Ionic) 我在角度和离子(Android 应用)上使用 SignalR
当我向 Web 应用程序(Angular 或 Ionic)中的所有客户端发送 signalR 它给了我警告并继续代码
Warning: No client method with the name 'XX' found.
但是当我向 Android 应用程序中的所有客户端发送 signalR 时,它会给我同样的警告并停止
只有当我将 SignalR 发送给所有客户端时才会发生这种情况
C# 代码
public async Task HandleEventAsync(DriverClientBookingUpdateEto bookingUpdateEto)
{
if (bookingUpdateEto.BookingTimeFrame == BookingTimeFrame.Future)
{
await _hubContext.Clients.All.SendAsync("DriverClientBookingUpdate", bookingUpdateEto);
}
else
{
string _groupName = bookingUpdateEto.Id.ToString();
if (bookingUpdateEto.ConnectionIds.Count == 0)
{
await _hubContext.Clients.Group(_groupName).SendAsync("DriverClientBookingUpdate", bookingUpdateEto);
}
else if (bookingUpdateEto.ConnectionIds.Count == 1)
{
await _hubContext.Clients.Client(bookingUpdateEto.ConnectionIds[0]).SendAsync("DriverClientBookingUpdate", bookingUpdateEto);
}
else if (bookingUpdateEto.ConnectionIds.Count > 1)
{
AddSurroundingDriversConnectionIdToGroup(bookingUpdateEto.ConnectionIds, _groupName);
await _hubContext.Clients.Group(_groupName).SendAsync("DriverClientBookingUpdate", bookingUpdateEto);
}
}
}
打字稿代码
private registerSignalEvents() {
this.hubConnection.on('DriverClientBookingUpdate', (order: OrderModel) => {
this.orderSvc.handleOrderUpdate(order);
});
}
【问题讨论】:
-
它是如何“停止”的?堆栈跟踪是否存在异常?
标签: asp.net angular signalr ionic4 abp