Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WebSocket connection to 'wss://127.0.0.1:5500/fsws' failed #45

Open
wideweide opened this issue Oct 11, 2023 · 3 comments
Open

WebSocket connection to 'wss://127.0.0.1:5500/fsws' failed #45

wideweide opened this issue Oct 11, 2023 · 3 comments
Labels
bug Something isn't working

Comments

@wideweide
Copy link

Describe the bug
A clear and concise description of what the bug is.

try connect websocket then failed many times...

WebSocket connection to 'wss://127.0.0.1:5500/fsws' failed

Have a question?
Join the discussions instead.

@yandeu yandeu added the bug Something isn't working label Oct 11, 2023
@yandeu
Copy link
Owner

yandeu commented Oct 11, 2023

Can you tell me what OS and Browser you use?

Do you use https?

@wideweide
Copy link
Author

Can you tell me what OS and Browser you use?

Do you use https?

not use https,just http://127.0.0.1:5500/index.html ,but in browser console WebSocket connection to 'wss://127.0.0.1:5500/fsws' failed
OS: pop! os (ubuntu) ,win11
browser: firefox /chrome

it seems some js error caused the error, some pure html page is work fine.
my js has many code , I am not sure which code cause this. at last I found maybe iframe caused ,some code like here:

<script>
    function load(){
        document.getElementById('iT').src='examples/0001.html'
    }
</script>
<h1>test iframe </h1> 
<iframe id="iT" onload="load()"></iframe>

then


[Five Server] connecting...
VM428 fiveserver.js:1 [Five Server] connecting...
VM429 fiveserver.js:1 [Five Server] connecting...
VM430 fiveserver.js:1 [Five Server] connecting...
VM431 fiveserver.js:1 [Five Server] connecting...
VM431 fiveserver.js:1 [Five Server] status check...
VM432 fiveserver.js:1 [Five Server] connecting...
VM433 fiveserver.js:1 [Five Server] connecting...
VM433 fiveserver.js:1 [Five Server] status check...
VM434 fiveserver.js:1 [Five Server] connecting...
VM435 fiveserver.js:1 [Five Server] connecting...
VM436 fiveserver.js:1 [Five Server] connecting...
VM437 fiveserver.js:1 [Five Server] connecting...

@yandeu
Copy link
Owner

yandeu commented Oct 12, 2023

I see. Yes the error is from inside the iFrame.

Try to wait for five-server to connect:

<script>
  function load() {
    function run(e) {
      console.log('Some JavaScript Code...')
      document.getElementById('iT').src = 'examples/0001.html'
    }
    // wait for five-server to connect
    const five = document.querySelector('[data-id="five-server"]')
    if (five) five.addEventListener('connected', run)
    window.addEventListener('load', run)
  }
</script>
<h1>test iframe</h1>
<iframe id="iT" onload="load()"></iframe>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants