How to update only specific page's Likes count using SignalR in MVC
<p>I have a problem in implementing SignalR in my MVC application. I am updating my posts like count every time a person clicks on like button of a specific album post page. But I am facing a problem here that when I click on Like button of a specific page, the likes count of the other pages is also incremented.</p>

<p>so here is my NotificationHub code:</p>

<pre><code>public class NotificationHub : Hub
{

    public void Like(Guid albumId, Guid managerId)
    {
        IHubContext context = GlobalHost.ConnectionManager.GetHubContext&lt;NotificationHub&gt;();
        var LikeCounter = SaveLike(albumId, managerId);
        Clients.All.updateLikeCount(LikeCounter);
    }

    public int? SaveLike(Guid albumId, Guid managerId)
    {
        // my implementation code
    }


    public override Task OnConnected()
    {
        return base.OnConnected();
    }
    public override Task OnDisconnected(bool stopCalled)
    {
        return base.OnDisconnected(stopCalled);
    }
    public override Task OnReconnected()
    {
        return base.OnReconnected();
    }

}
</code></pre>

<p>This is my jQuery code:</p>

<pre><code>$(function () {
        var albumClient = $.connection.notificationHub;
        albumClient.client.updateLikeCount = function (likes) {
            var counter = $(".like-count");
            $(counter).fadeOut(function () {
                $(this).text(likes);
                $(this).fadeIn();
            });
        };
        $(".like-button").on("click", function () {
            var albumId = $(this).attr("data-id");
            var managerId = $(this).attr("id");
            albumClient.server.like(albumId, managerId);
        });

        $.connection.hub.start();

    });
</code></pre>

<p>So kindly help me what I am doing wrong or what modifications are needed in this code.</p>