-
Notifications
You must be signed in to change notification settings - Fork 32
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
Different websocket addresses for different simultaneous platforms #54
Comments
Not possible currently I think. And I'm not sure what would be a solution to this. As far as I know the websocket client needs an address and port. Also, in client code it can be difficult to detect what is the current client. One solution would be to the same hostname for websocket connection as is used to load the page, but that doesn't solve all cases so I don't think it's worth the complexity. Maybe you could configure your network so that you have single IP which is accessible from all clients? |
To setup loopback alias for browser and maybe ios simulator: # linux?
ifconfig lo: 10.0.2.2 netmask 255.0.0.0 up
# os x?
ifconfig lo0 alias 10.0.2.2 |
Thanks @Deraen you comment made me realise that there is a very easy solution to this problem: (task-options!
reload {:ws-host (.getHostAddress (java.net.Inet4Address/getLocalHost))}) And voilà, the websocket connects to all three platforms without problems! However, this story still has no happy ending. When I try to reload on android |
File urls never work with ips, they are always to local filesystem. Reload client is set to load files from same url as they were initially loaded. This part of code is where JS files are reloaded: https://github.com/adzerk-oss/boot-reload/blob/master/src/adzerk/boot_reload/reload.cljs#L42-L44 Is there a possibility to get android load files from HTTP server instead? |
Interesting. Figwheel does not have the same problem because it uses a static file server to serve those files over I don't know if that's the direction |
Usually one uses boot-http or project http server to serve the files. |
Yeah but having it integrated in this plugin means |
No, it shouldn't need to be integrated into this plugin. Boot-reload should already reload files over http BUT you probably need to load the HTML over http. |
That's the point. When running on a device (cordova, React Native) the file is not loaded over http. Wouldn't it be nice to support those platforms too? |
Boot-react-native seems to have some workarounds to make boot-reload work. It would be nice to support those platforms too but I don't think integrating http server is needed for that. We could either require user to use boot-http or depend on boot-http and compose reload with boot-http to start server, but I would probably prefer the first option if the configuration doesn't get too complex. Some kind of reload-url-fn or prefix option might be enough. Do you have some example project I could take a look at? |
Yes, I have a very sample example pushed at https://github.com/frankiesardo/cadabra. You can run only the Android platform if you like, that's the one I'm having problems with. |
maybe the |
Yes, it works beautifully! Thanks a bunch for the help guys, I've updated the This change is so good that it makes it trivial to use |
Great to hear @frankiesardo! Took me a while to realize that the solution was already there haha. Cheers! 🍻 |
I'll be doing release this weekend. |
0.4.3 is now available. |
We are running a cordova application that targets browser, ios and android.
The default reload address
ws:localhost:..
works wonder with the browser and the ios simulator, allowing us to push the changes to both simultaneously.However the Android emulator remaps
localhost
to10.0.2.2
. I can change mybuild.boot
to use(reload :ws-host "10.0.2.2")
, but this way we cannot develop with a single reloaded workflow on all three platform simultaneously.Our ultimate dream is: having the three platform screens side by side and see our changes propagate to all of them in realtime ⭐ I wonder if boot has a way to accomplish this with.
The text was updated successfully, but these errors were encountered: