Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Documentation is (possibly) wrong - when to use generated proxy and when not to #4190

Closed
joe-oli opened this issue Sep 5, 2018 · 1 comment
Milestone

Comments

@joe-oli
Copy link

joe-oli commented Sep 5, 2018

Doco at the following url states:
https://docs.microsoft.com/en-us/aspnet/signalr/overview/guide-to-the-api/hubs-api-guide-javascript-client

When to use the generated proxy
If you want to register multiple event handlers for a client method that the server calls, you can't use the generated proxy. Otherwise, you can choose to use the generated proxy or not based on your coding preference.

I have registered multiple client-side handlers, and it works.
For example
var pxyHub = $.connection.MySRHub;
pxyHub.client.someHandlerOne = function (p1, p2) {... etc...};
pxyHub.client.someHandlerTwo = function (whatever) {... etc...};

@analogrelay
Copy link
Contributor

analogrelay commented Sep 5, 2018

The docs are referring to multiple handlers for the same method (hence "multiple event handlers for a client method"). I.e. code like this (note the += operator doesn't work this way in JavaScript so this is pseudo code that does not actually work):

var pxyHub = $.connection.MySRHub;
pxyHub.client.someHandlerOne += function (p1, p2) {... etc...};
pxyHub.client.someHandlerOne += function (whatever) {... etc...};

@analogrelay analogrelay added this to the Discussions milestone Sep 5, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants