locked
ReferenceError: chatHub is not defined[Learn More] LetsChat:186:17 RRS feed

  • Question

  • User81789783 posted

    i am facing an error .in fact its stopped working suddenly .any help

    ReferenceError: chatHub is not defined[Learn More] LetsChat:186:17
    <anonymous> http://localhost:55590/LetsChat/LetsChat:186
    jQuery 15

    c

    fireWith

    o[0]

    start

    dispatch

    handle

    trigger

    triggerHandler

    d

    initReceived

    success

    c

    fireWith

    k

    r

    Wednesday, May 1, 2019 2:58 AM

Answers

  • User81789783 posted

    remove this line

    chatHub.server.sendMessageToAll(userName, msg);

    and solve

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, May 1, 2019 3:34 AM

All replies

  • User81789783 posted

    here is detailed error from chrome

    LetsChat:186 Uncaught ReferenceError: chatHub is not defined
    at Object.<anonymous> (LetsChat:186)
    at c (jquery-1.10.2.min.js:21)
    at Object.fireWith [as resolveWith] (jquery-1.10.2.min.js:21)
    at Object.i.(:55590/LetsChat/anonymous function) [as resolve] (http://localhost:55590/Scripts/jquery-1.10.2.min.js:21:27824)
    at t.fn.init.<anonymous> (jquery.signalR-2.2.0.min.js:8)
    at t.fn.init.dispatch (jquery-1.10.2.min.js:22)
    at t.fn.init.v.handle (jquery-1.10.2.min.js:22)
    at Object.trigger (jquery-1.10.2.min.js:22)
    at init.triggerHandler (jquery-1.10.2.min.js:22)
    at jquery.signalR-2.2.0.min.js:8

    Wednesday, May 1, 2019 3:05 AM
  • User81789783 posted

    remove this line

    chatHub.server.sendMessageToAll(userName, msg);

    and solve

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, May 1, 2019 3:34 AM
  • User61956409 posted

    Hi erum,

    erum

    remove this line

    chatHub.server.sendMessageToAll(userName, msg);

    and solve

    Glad to hear that you resolve the problem by yourself. But if you comment out the above code snippet, corresponding functionality of call the hub method would not work.

    erum

    Uncaught ReferenceError: chatHub is not defined

    Based on my experience, if we do not declare a proxy to reference the hub, or use incorrect hub proxy object to call hub method, which will cause this issue.

    You can refer to [this documentation](https://docs.microsoft.com/en-us/aspnet/signalr/overview/guide-to-the-api/hubs-api-guide-javascript-client#how-to-get-a-proxy-for-a-hub-class) to get proxy object and call hub method(s).

    With Regards,

    Fei Han

    Wednesday, May 1, 2019 5:37 AM