问题描述
我尝试使用 signalr_core 库在 Flutter 应用程序中发送消息,服务器是 dotnet 核心,由于服务器中的错误而导致错误未发送,但是当我在 web 中使用 SignalR 时,它正常发送,我认为 Flutter 中存在错误。
> public async Task SendMessage(List<dynamic> message)
{
var msgs = message.Select(item => item?.ToString()).ToList();
if (msgs.Count == 3)
{
if (msgs[1] == string.Empty)
{
string msg = msgs[2];
string except = msgs[0];
Console.WriteLine("broadcast");
await Clients.AllExcept(except).SendAsync("ReceiveMessage",msg);
}
else
{
string from = msgs[1];
string msg = msgs[2];
await Clients.Client(from).SendAsync("ReceiveMessage",msg);
}
}
}
Q.hupConnection.invoke('SendMessage',args: <String>[ "ycROsEyZzVezFO_wprihvQ","gXFB81vDH4e6uWtDG88Q","hello" ])
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)