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

Start with a different port #290

Closed
TylerLeonhardt opened this issue Aug 24, 2022 · 1 comment
Closed

Start with a different port #290

TylerLeonhardt opened this issue Aug 24, 2022 · 1 comment
Assignees
Labels
feature-request Request for new features or functionality

Comments

@TylerLeonhardt
Copy link
Member

Testing microsoft/vscode#158835

3000 is too common. It's the default port for a lot of node apps and if the user needs to locally run their API (on port 3000) and use live server to host their client side that makes calls to the API, there will be a non-zero amount of times where they start live server first, it takes 3000 and then their API fails to start because we've taken it.

AFAICT, the default port of Live Preview doesn't need to be 3000. It can be anything... so maybe we go with a larger, more random number and go from there? Like 31545.

Another thing to explore is asking for port 0 which will return a random unused port:
https://stackoverflow.com/questions/948122/get-a-random-high-port-number-that-is-still-available#:~:text=Assigning%20random%20ports%20is%20already%20part%20of%20the,port%20number%20will%20be%20still%20available.%20%E2%80%93%20PSkocik

@TylerLeonhardt TylerLeonhardt transferred this issue from microsoft/vscode Aug 24, 2022
@andreamah andreamah added the feature-request Request for new features or functionality label Aug 24, 2022
@andreamah andreamah added this to the On Deck milestone Dec 9, 2022
@andreamah andreamah modified the milestones: On Deck, December / January 2024 Dec 12, 2023
@andreamah
Copy link
Contributor

there will be a non-zero amount of times where they start live server first, it takes 3000 and then their API fails to start because we've taken it.

This is quite an old issue, although I'm giving this a bit more thought. If it's a conflict with a user API, they can set the default port to be something else (which is a one-time change). Keeping it as 3000 makes it easy to remember, which comes in handy if the commands to open the preview ever fail.

I will close this for now, unless there are any other reasons not to use 3000. The process of changing the default port is not too tricky and I expect that anyone running something that doesn't have a fallback port should be able to set the live preview default port to something else.

@andreamah andreamah closed this as not planned Won't fix, can't repro, duplicate, stale Dec 13, 2023
@andreamah andreamah removed this from the December / January 2024 milestone Jan 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request Request for new features or functionality
Projects
None yet
Development

No branches or pull requests

2 participants