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

allow to use port 0 #100

Open
DarkPark opened this issue Jan 27, 2016 · 3 comments
Open

allow to use port 0 #100

DarkPark opened this issue Jan 27, 2016 · 3 comments

Comments

@DarkPark
Copy link

It's possible to have more than one project using livereload and running at the same time.
It would be nice to allow OS to dynamically randomly generate ports on server creation.

So the following code should not create a server on the default port 35729 but on some random one:

server.listen(0, function () { ... });
@shama
Copy link
Collaborator

shama commented Jan 27, 2016

Currently the strategy is to leave that sort of behavior up to the user. Check out https://www.npmjs.com/package/openport It's a pretty nice library for finding an open port.

@DarkPark
Copy link
Author

Openport is a good but redundant solution.
This library will try to create a net server and if fail try some other port till server is created successfully. Then is close this server. So eventually you will have some port. But why so much efforts? Just specify zero port and operating system itself provides an available port. No need to use hacks, probe any ports, to waist time and resources.

@mklabs
Copy link
Owner

mklabs commented May 30, 2016

I agree, tiny-lr should allow random port. I believe this is likely because of a falsy check on the port options.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants