SignalR proxy object exception: Uncaught TypeError: Cannot read property 'client' of undefined conclusion, signalruncaught
A DntHub hub is created in the background.
The front-end encountered a problem during the call (the proxy object failed to be created after check)
So I found the following on StackOverflow:
Http://stackoverflow.com/questions/14146913/signalr-cannot-read-property-client-of-undefined
As mentioned above, it will be OK if it is changed to lower-case letters. Many people have successfully solved the problem.
Changed to lower case after the last day. var chat = $. connection. dntHub
Many people may ignore it ~~~~ But, why did I solve it like this? C # Is the naming rule capitalized?
I like to go deep into it, so I opened its dynamically generated js and found such a sentence.
So, which is generated by default at the beginning of lower case )... Many people say it's over? NONONO
What do programmers need? Imagination and unconventional imagination!
Then I can imagine whether we can specify a name?
I searched the internet.HubName ("xxx ")You can set the name.
By extension, you can set any name, which is not necessarily the same as the class name.
So try again?
Look at the dynamically generated js,
Hey, great!
Conclusion:
If you do not set HubName yourself, SignalR will automatically generate a HubName with the same name as the class name and starting with lowercase letters.
There are two solutions to this problem: one is to use the lower-case HubName in js, and the other is to specify