c# - SignalR not call a seconf Hub Class -
i have 2 hub class in project
public class foldermanager : hub { public foldermanager() { } public void validator() { } } public class seocontentvalidator : hub { public seocontentvalidator() { } public void validator() { } }
i have start class
public class startup { public void configuration(iappbuilder app) { app.mapsignalr(); } }
in view have script
<script src="~/scripts/jquery.signalr-2.2.0.js" type="text/javascript"></script> <script src="~/signalr/hubs" type="text/javascript"></script> <script> jquery(document).ready(function(){ var foldermanager = $.connection.foldermanager; var seocontentvalidator = $.connection.seocontentvalidator; $.connection.hub.logging = true; $.connection.hub.start().done(function () { foldermanager.server.validator(); seocontentvalidator.server.validator(); }); }); </script>
the problem have signalr can find , call foldermanager.server.validator();
but cant find seocontentvalidator.server.validator();
what doing wrong in seocontentvalidator signalr can not find it
this should work fine. in fact, tried example. signalr/hubs generated proxy has following code:
proxies['foldermanager'] = this.createhubproxy('foldermanager'); proxies['foldermanager'].client = { }; proxies['foldermanager'].server = { validator: function () { return proxies['foldermanager'].invoke.apply(proxies['foldermanager'], $.merge(["validator"], $.makearray(arguments))); } }; proxies['seocontentvalidator'] = this.createhubproxy('seocontentvalidator'); proxies['seocontentvalidator'].client = { }; proxies['seocontentvalidator'].server = { validator: function () { return proxies['seocontentvalidator'].invoke.apply(proxies['seocontentvalidator'], $.merge(["validator"], $.makearray(arguments))); } };
and on start js log states:
[ ... ] signalr: invoking foldermanager.validator [ ... ] signalr: invoking seocontentvalidator.validator
i set breakpoints on hub methods , ran app in debug mode. both breakpoints triggered.
is js code copied present in generated proxy file? have no js errors when running?
i assume example code wrote not actual code. try debug code, use detailed error messages:
public class startup { public void configuration(iappbuilder app) { var hubconfiguration = new hubconfiguration(); hubconfiguration.enabledetailederrors = true; app.mapsignalr(hubconfiguration); } }
wrap hub methods in try-catch blocks, can lot.
let me know if found problem.
Comments
Post a Comment