1
votes

I have created 2 signalr Hub class that inherits from Microsoft.AspNet.SignalR.Hub, ActivityFeedHub class and ChannelHub class. i get a warning for ChannelHub class that class name is not CLS-complaint as base class Hub is not CLS-complaint. The /signalr/hubs file generated is wrong. Two hub proxies should get created i.e.'activityFeedHub' and 'channelHub' , but instead 'channelHub' it creates some pr0xy with wrong name and methods name i.e. 'K' . Below is the file. Whenever i try to access the connection using channelHub proxy name using "$.connection.channelHub" it gives me error -Uncaught TypeError: Cannot read property 'client' of undefined .

Can someone please let me know what is the issue here and suggest me a fix

    $.hubConnection.prototype.createHubProxies = function () {
        var proxies = {};
        this.starting(function () {
            // Register the hub proxies as subscribed
            // (instance, shouldSubscribe)
            registerHubProxies(proxies, true);

            this._registerSubscribedHubs();
        }).disconnected(function () {
            // Unsubscribe all hub proxies when we "disconnect".  This is to ensure that we do not re-add functional call backs.
            // (instance, shouldSubscribe)
            registerHubProxies(proxies, false);
        });

        proxies['activityFeedHub'] = this.createHubProxy('activityFeedHub'); 
        proxies['activityFeedHub'].client = { };
        proxies['activityFeedHub'].server = {
            joinActivityFeed: function (ActivityFeedActorID) {
                return proxies['activityFeedHub'].invoke.apply(proxies['activityFeedHub'], $.merge(["JoinActivityFeed"], $.makeArray(arguments)));
             },

            leaveActivityFeed: function (ActivityFeedActorID) {
                return proxies['activityFeedHub'].invoke.apply(proxies['activityFeedHub'], $.merge(["LeaveActivityFeed"], $.makeArray(arguments)));
             },

            updateActivity: function (relevantActivity) {
                return proxies['activityFeedHub'].invoke.apply(proxies['activityFeedHub'], $.merge(["UpdateActivity"], $.makeArray(arguments)));
             }
        };

        proxies['k'] = this.createHubProxy('k'); 
        proxies['k'].client = { };
        proxies['k'].server = {
            a: function (channelID) {
                return proxies['k'].invoke.apply(proxies['k'], $.merge(["a"], $.makeArray(arguments)));
             },

            b: function (pinnedItem) {
                return proxies['k'].invoke.apply(proxies['k'], $.merge(["b"], $.makeArray(arguments)));
             },

            c: function (ChannelID) {
                return proxies['k'].invoke.apply(proxies['k'], $.merge(["c"], $.makeArray(arguments)));
             },

            d: function (channelId) {
                return proxies['k'].invoke.apply(proxies['k'], $.merge(["d"], $.makeArray(arguments)));
             },

            e: function (channelId) {
                return proxies['k'].invoke.apply(proxies['k'], $.merge(["e"], $.makeArray(arguments)));
             }
        };

        return proxies;
    };

    signalR.hub = $.hubConnection("/signalr", { useDefaultPath: false });
    $.extend(signalR, signalR.hub.createHubProxies());

}(window.jQuery, window));
1

1 Answers

0
votes

Its a Obfuscation issue . It got fixed by de-obfuscating the Hub class for which signalr server was not able to create correct proxiy with correct hubname. It is nothing to do with the Hub class being non- CLS complaint.