microsoft / microsoft/vscode-livepreview

Changing the port breaks reloading

Open
#146 1 comment 0 reactions 1 assignee View on GitHub

@andreamah is already working on this.

Since Dec 8, 2022.

bug
Dominant language
TypeScript
Stars
596
Forks
119
Avg merge
1d 4m
Merged PRs (30d)
5

Description

After modifying the port number from 81 to 80, the page spits out an error:
___vscode_livepreview_injected_script:28 WebSocket connection to 'ws://127.0.0.1:81/' failed

Reproducible Steps:

  1. Change the "Live Preview: Port Number" option from 81 to 80
  2. Start the server
  3. Open the page externally (I'm using the Brave Browser)
  4. An error should appear in DevTools' console

Expected Behaviour:
I expected the websocket connection to point to the new port number of 80, but it still attempts to connect to 81

Suspect Code:
Line 27 & 28 of ___vscode_livepreview_injected_script:

function onLoad() {
	let connection = new WebSocket('ws://127.0.0.1:81');

I do not know what writes these values, otherwise I'd write a PR.

Images:
Configuration Option: "Port Number"
Console with error

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.