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
Don't use hard-coded localhost for websocket #258
Comments
Thanks for your report. I published version
For now the PORT for |
I will give the new version a try today, thank you. The diff does look good to me! |
@davidhao3300 Thanks. I am looking forward to your confirmation. |
Looks good to me, thank you! |
@all-contributors please add @davidhao3300 for bug |
I've put up a pull request to add @davidhao3300! 🎉 |
Describe the bug
localhost is hard-coded here: https://github.com/nvh95/jest-preview/blob/v0.3.1/cli/server/ws-client.js#L4
This makes remote development a little more finicky. I'm running jest-preview in a remote server, and want to use my laptop's browser to visit the jest preview dashboard. Right now the dashboard loads fine, but since the websocket client tries to hit localhost, the auto-reloading doesn't work. I haven't tried it, but I believe a SSH tunnel would work around the issue, but would prefer not have to set that up.
I manually replaced localhost with my remote server's address, and things worked great
Screenshots
N/A
Reproduce
On a remote server with ports 3336 and 3337 available, run
yarn jest-preview
. Attempt to visit the remote IP at port 3336. Note that the JS console says that it tries to reach localhost:3337Expected behavior
I think the simplest and almost-strictly-better than current state is to use the browser host (window.host or whatever) as the hostname. For people using localhost, things will continue to work like before, while those using non-localhost should now automatically work, assuming that port 3337 is reachable.
There is an edge case for people who use 3336 with a remote hostname, but need a localhost 3337 for some reason...
Environment (please complete the following information)
Running yarn jest-preview on a remote server, 0.3.1
The text was updated successfully, but these errors were encountered: