I can not define "client" signalR


I am starting to work with signalR but I have an error (I have seen several answers on the web but none has helped me), I have the following files


using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Microsoft.AspNet.SignalR;
using Microsoft.AspNet.SignalR.Hubs;

namespace EjemploSignal
    public class GenteHub:Hub
        public static void llenarDatos()
            IHubContext context = GlobalHost.ConnectionManager.GetHubContext<GenteHub>();

JS file

var notificationHub = $.connection.genteHub;

    $.connection.hub.start().done(function () {

    $.notificationHub.client.updateDatos = function () {

    function cargarDatos() {
            url: "~/Home/lista",
            method: "GET",
            async: false,
            dataType: "json",
            success: function (respuesta2) {
                console.log("Respuesta", respuesta2);


Layout reference.html

<script src="~/Scripts/jquery-3.3.1.js"></script>
    <script src="~/Scripts/jquery.signalR-2.3.0.js"></script>
    <script src="~/signalr/hubs"></script>
    <script src="~/Scripts/enlace.js"></script>
    <script src="~/Scripts/modernizr-2.6.2.js"></script>
    <script src="~/Scripts/bootstrap.min.js"></script>

I have 2 errors that come to me the first one is the console:

According to several examples is because I do not put the name of the class and others is that I must put the name of [HubMethodName] (I already put both and it does not matter)

The second error I get in the Network:

if (typeof ($.signalR) !== "function") {
        throw new Error("SignalR: SignalR is not loaded. Please ensure jquery.signalR-x.js is referenced before ~/signalr/js.");

Which is because the file hub is not being generated because:

  • The correct order of the files is not being placed (When I have them in order "jquery, jquery signal, hub")
  • The symbol must be placed or not (~) (The bad thing is that I have already put it on and take it away and the error still persists)

What am I doing wrong?

asked by Baker1562 27.09.2018 в 20:49

1 answer


You must remove $. of the variable

notificationHub.client.updateDatos = function () {
answered by 27.09.2018 / 21:03