Question

My app is using a SignalR 1.1.2 on ASP.NET MVC It has the following call in the View

This uses the auto-generated hub. At this point all client and server side methods are done.

Can I get a copy of the 'hubs.js' file I get when I paste this link into the browser.

I want to add a new javascript file to the BundleConfig.cs so I can minify this file and try and improve the performance of my app.

Hope someone can advise, I have done it and it seems to work, I just want to be sure that I will not loose the ability to shift gears to websockets, SSE, Forever-Frame depending on what the client and server can negotiate.

Was it helpful?

Solution 2

if you navigate to the /signalr/hubs uri you can save this javascript file and put it in a bundle. Of course if you change anything to do with signalr then it might not work. But this is for release. Just a note that this 1.1.2

OTHER TIPS

MVC web optimization does not support dynamic scripts. I did it like this in my last project, it doesnt help with minifying but you can add the static script to the bundle config

(function ($) {
    var dynamicScripts = ["signalr/hubs", "eventAggregation/events"];
    $.each(dynamicScripts, function () {
        $.ajax({
            url: this,
            cache: true,
            dataType: "script",
            async: false
        });
    });
} (jQuery));
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top