1

I am using SignalR 5.0, I am trying to send a JSON from the Android client. 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. Added 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; }
}

Java code: enter image description here

Methods (.net core 5)

    public void Pong(PongModel pongModel)
    {
    }

    public void Send(string test)
    {
    }
2
  • Your server logs should clarify the issue. Likely mapping to the model is not correct. For example - in your json Id is string, but in model class it's int. Dates format might also be problematic Commented Nov 23, 2020 at 20:03
  • Yes, it works ! Commented Nov 23, 2020 at 20:25

1 Answer 1

0

Pass object directly example without serializing: hubConnection.send("Pong", p); Add this to get the binding error: "Microsoft.AspNetCore.SignalR": "Debug", "Microsoft.AspNetCore.Http.Connections": "Debug"

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.