SignalR message content is different between sent and received

悠葵 佐和田 0 Reputation points
2023-03-17T12:14:50.9066667+00:00

We are building a chat system using SignalR. However, we have encountered an issue where the content sent and received are different. What could be the solution to this problem?

The following message is a trace of a SignalR message using EDGE developer tools.

The following part is missing: ,"isPaid":true,"amount":5

{"type":1,"target":"SendMessageComments","arguments":["sasa",{"id":148353,"userId":"1","userName":"sasa","profilePicturePath":"https://sasa.blob.core.windows.net/production/Profile_1aa3273.jpg","postId":225,"content":"3333333333333333","ipAddress":null,"deviceInfo":null,"parentId":0,"isDeleted":false,"isShow":false,"isPaid":true,"amount":5}]}

{"type":1,"target":"ReceiveMessage","arguments":["sasa","Comments","{\"Id\":148353,\"UserId\":\"1\",\"UserName\":\"sasa\",\"ProfilePicturePath\":\"https://sasa.blob.core.windows.net/production/Profile_1aa3273.jpg\",\"PostId\":225,\"Content\":\"3333333333333333\",\"IPAddress\":null,\"DeviceInfo\":null,\"ParentId\":0,\"IsDeleted\":false,\"IsShow\":false}"]}


Azure SignalR Service
Azure SignalR Service
An Azure service that is used for adding real-time communications to web applications.
120 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. brtrach-MSFT 15,176 Reputation points Microsoft Employee
    2023-03-21T03:37:08.3533333+00:00

    The issue you are encountering is that the content sent and received are different. The content sent has the following part missing: ,"isPaid":true,"amount":5.

    This issue could be caused by a number of reasons, including network latency, incorrect serialization, or incorrect handling of the message on the receiving end.

    To resolve this issue, you can try the following steps:

    1. Verify that the message is being sent correctly from the client
    2. Check that the message is being received correctly on the server
    3. Ensure that the message is being serialized and deserialized correctly.
    4. Make sure that the message is being handled correctly on the receiving end.

    If these steps do not resolve the issue, you may need to review and debug your code further. Please let us know the outcome of the above suggestions.

    0 comments No comments