thanethomson / httpwatcher

Python-based HTTP server for static files with live reload
MIT License
20 stars 10 forks source link

Error during WebSocket handshake: Unexpected response code: 403 #8

Open irdroid3 opened 3 years ago

irdroid3 commented 3 years ago

When looking for errors in my html... I spotted these in the Chrome developer logs :

Message 1 : WebSocket connection to 'ws://cap-wb1:1080/httpwatcher' failed: Error during WebSocket handshake: Unexpected response code: 403

Expanded that message twisty and I see :

Message 2 : WebSocket error: [object CustomEvent]

This message does not have a twisty to expand. On the right of the above message, it has : httpwatcher.min.js:formatted:51

In the sources panel for httpwatcher.min.js, it has these for the above line numbers - Line 51 = console.log("WebSocket error: " + e) Line 140 = if (l = new WebSocket(s.url,t || []), Line 185 = s.open(!0)

I am not sure how much of an issue this is; just that I like to see no errors in logs... I have yet to fathom how often this happens - I started the page earlier this afternoon and I now have 389 errors showing on the page in chrome (late afternoon) - probably dependent on how often the page is refreshing itself? - but that seems too often for that.

Any ideas? Cheers, Ian .

irdroid3 commented 3 years ago

The 403 errors were in a browser on the same Raspberry Pi - running a small Kiosk app... The kiosk has stayed up longer now that I have stopped the 403 messages appearing - I think, as memory is tight on a the RPi0W, I need to stop all such things that can eat up log space etc... See my update to the server.py : https://github.com/irdroid3/httpwatcher/blob/master/httpwatcher/server.py

jobveldhuis commented 3 years ago

Hey there, could you test this issue against the current dev branch and see if it still persists?

irdroid3 commented 3 years ago

Will do (sorry for the delay), thank you. Edit : What is the best way to install the Dev code? - any pip method ? or copy the 4 *.py files into : ~/.local/lib/python3.7/site-packages/httpwatcher/

irdroid3 commented 3 years ago

Hi Job (@jobveldhuis), I just copied the server.py in from dev and I do not see 403 errors now!!! - Many thanks

jobveldhuis commented 3 years ago

Brilliant. I will be working closely with @thanethomson to make sure this also lands at the packaging index, so you can just update your installed module.

AstraLuma commented 1 year ago

I'm running into something similar. Looks like it's fixed by #6, but that hasn't been released yet.

jobveldhuis commented 1 year ago

Yeah this should solve that. Unfortunately, I cannot release new versions of this to Pypi. @thanethomson do you have time to draft a new release?