SignalR chat-check if message sent successfully

I made a chat using the signalR hub and it works great. Now what I want to do is that the server should send a notification to the client if its message was sent successfully. How can i do this? Thank!!

+4
source share
1 answer

To ensure that the message reaches the client successfully, in the client method that receives this message, you must call the server method to confirm it.

For example, on the server you have

Clients.All.hello();

On the client, you should do something like this:

myHubConnection.client.hello = function () {
     //do your stuff
     myHubConnection.server.notifyTheServer(messageId);
};
+4
source

Source: https://habr.com/ru/post/1535065/


All Articles