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

URL (location) path in watcher javascript is probably wrong #8

Open
petr-fischer opened this issue Mar 28, 2019 · 3 comments
Open

URL (location) path in watcher javascript is probably wrong #8

petr-fischer opened this issue Mar 28, 2019 · 3 comments

Comments

@petr-fischer
Copy link

kemal watcher works when I access root URL during development in the browser, like http://localhost:3000.

But if I want to test subpages, like http://localhost:3000/aaa or http://localhost:3000/aaa/bbb - watcher javascript tries to repeatedly connect to wrong websocket path on the kemal server (websocket runs on the root path/URL, right?).

Is it clear?

@petr-fischer petr-fischer changed the title URL (location) path is probably wrong URL (location) path in watcher javascript is probably wrong Mar 28, 2019
@faustinoaq
Copy link
Owner

Hi @petr-fischer Thank you for opening this issue, I'll try to fix this, also feel free to send a PR if you found some fix for this before me 😉

(websocket runs on the root path/URL, right?).

Yeah, this was kinda workaround, I guess this tool need some refactoring 😅

@petr-fischer
Copy link
Author

I just changed line 13 in src/kemal-watcher/watcher_handler.cr from:

var address = protocol + window.location.host + window.location.pathname + `#{WEBSOCKETPATH}`;

to:

var address = protocol + window.location.host + '/' + `#{WEBSOCKETPATH}`;

but I am not sure, if this is right workaround for everyone :/

@faustinoaq
Copy link
Owner

@petr-fischer Oh ok, I'll try, Thank you for your comment 👍

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

No branches or pull requests

2 participants