[英]Send a json object to .net server using signalr and Java client
I am using SignalR 5.0, I am trying to send a JSON from the Android client.我正在使用 SignalR 5.0,我正在尝试从 Android 客户端发送 JSON。 I have looked into this .
我已经看着这个。 But it's not working for me, the send works I get the json in the test "{"Id":"123123","ReceviedDateTime":"Nov 23, 2020 12:50:55 PM","RepliedDatetime":"Nov 23, 2020 12:50:55 PM"}" but the Pong method is never called.
但它对我不起作用,发送工作我在测试中得到了 json "{"Id":"123123","ReceviedDateTime":"Nov 23, 2020 12:50:55 PM","RepliedDatetime":"Nov 23, 2020 12:50:55 PM"}" 但从未调用 Pong 方法。 Added services.AddSignalR().AddJsonProtocol();
添加了 services.AddSignalR().AddJsonProtocol(); in the startup
在启动
Pong model:乒乓球模型:
public class PongModel
{
public int Id { get; set; }
public int DeviceId { get; set; }
public string PhoneNumber { get; set; }
public DateTime SendDatetime { get; set; }
public DateTime ReceviedDateTime { get; set; }
public DateTime RepliedDatetime { get; set; }
}
Methods (.net core 5)方法(.net core 5)
public void Pong(PongModel pongModel)
{
}
public void Send(string test)
{
}
Pass object directly example without serializing: hubConnection.send("Pong", p);不序列化直接传递对象示例: hubConnection.send("Pong", p); Add this to get the binding error: "Microsoft.AspNetCore.SignalR": "Debug", "Microsoft.AspNetCore.Http.Connections": "Debug"
添加此以获得绑定错误:“Microsoft.AspNetCore.SignalR”:“调试”,“Microsoft.AspNetCore.Http.Connections”:“调试”
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.