aurelia / dotnet

Official .NET tooling for Aurelia.
MIT License
33 stars 1 forks source link

Websockets is out of control! #2

Open roddharris opened 5 years ago

roddharris commented 5 years ago

So, I created a very basic project with the following lines

dotnet new -i aurelia-dotnet-templates
dotnet new aurelia -ht http2 -c sass -e none

I opened the solution in VS2017 and ran it using IIS Express. The page loads.

However, if I open dev tools as the page is loading, the Network information is going nuts with tons of websocket requests. There is nothing in app code that makes any kind of POST request and yet there are tons of POST requests being made in the Network area.

This activity goes on long after the page has loaded. In the end, the status bar indicates that 3.84MB of 3.88MB was transferred -- interesting since the entire dist folder is only 1MB. It also states there were 192 requests made -- my dist folder only has 22 files in it and the largest file is 107KB.

I'm very curious where all this extra activity and data is coming from.

brandonseydel commented 5 years ago

I would have to guess this is all the hot module reloading which will not occur in prod. You can remove it by passing a false into the following method. https://github.com/aurelia/dotnet/blob/85c4642161ef62fe49d8f50c9188b93742889101/NugetTemplates/Aurelia.DotNet.Spa/content/Aurelia.DotNet.Spa/Startup.cs#L187

roddharris commented 5 years ago

What you recommended disables HMR completely correct? I'm just curious why I don't see this same behavior in projects created with the Aurelia CLI that also include HMR?

brandonseydel commented 5 years ago

Can you attach your chrome network details to this so I can see.

roddharris commented 5 years ago

I'm using FireFox, but yes, here are the details from network. image

Incidentally, I noticed that I'm getting a ton of errors in the console window as well

image

roddharris commented 5 years ago

Loading the same page in Chrome gives a little different results.

image

image

So, I'm still getting some kind of WebSocket failure in Chrome, but it seems to quit after the first failure as opposed to FireFox that seems to keep trying to do whatever it is its trying to do.

brandonseydel commented 5 years ago

I pulled fresh from nuget and created a project with the same layout and had no errors?

image

brandonseydel commented 5 years ago

I still don't see this can I close or are you still getting?

roddharris commented 5 years ago

I tried to start a new project to test and see if this is still acting the same way -- however, it appears that when I install the template dotnet new -i aurelia-dotnet-templates, I'm getting the 2.2 version which means I only get one shot to test before a child process gets left open. The only way I know to get rid of the child process is to reboot my system. If you have an easier way of finding and killing that child process, that would be helpful. Better yet, if you have a way of loading the 2.1 version of the template I can re-test this for you and let you know if I'm still experiencing the issue.

brandonseydel commented 5 years ago

The new template should not be doing this? Make sure to check the project file for any existence of the InProcess and remove it.

brandonseydel commented 5 years ago

Grab the latest again as well. should be 1.5

roddharris commented 5 years ago

So I'm getting the same thing. I uninstalled the aurelia template and reinstalled 1.5 version. Created a new project dotnet new aurelia and ran it. I get Hello World! but in FireFox I get a ton of errors and requests (same as screen shots above) and in Chrome I basically get the same screen shots that I included before as well.

I made no changes to the app at all after creating the project.

(Incidentally, when I created a project with the newer version of the template -- the one with the process issue, I did not see this behavior.)

roddharris commented 5 years ago

I don't know if you're trying to track this down or not, but I did see a minor difference in what I'm getting now and the previous errors in FireFox. The name of the file where the error is occurring has changed slightly.

image

The original error was in line10 of a file named vendor~[hash name].chunk.js, the error I'm getting is now in line 10 of vendor.sockjs-client~[hash name].chunk.js. Maybe that was just a rename of some file in your code and doesn't mean anything -- but I thought I'd mention it just in case.

Again, in chrome, this is what I see

image

cnceniza commented 5 years ago

Having the same problem. I get numerous error on chrome. I installed the latest 1.5.0 template. Is there a workaround this? I have netcore2.2 version

@roddharris were you able to find a fix on this? how?

image