SignalR proxy object exception: Uncaught TypeError: Cannot read property & #39; client & #39; of undefined conclusion, signalruncaught

Source: Internet
Author: User

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

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.