Open bitspittle opened 3 years ago
Note that a "workaround" for people running their own servers is to serve the Kobweb site themselves.
kobweb export --layout static
.kobweb/site
statically
routing {
staticFiles("/", ".kobweb/site")
}
I already use Kobweb on the client side - it is great :) It would be nice if I could use live reloading support during development but also be able to use my Ktor-based backend which I cannot (and don't want to) replace.
@NorbertSandor hey, since you have a real case, I have a question for you. If I allowed you to set up my Kobweb server to act as a proxy for your server, would that work for you?
Getting live reloading to work for your custom server probably won't ever happen (getting it right takes a fair bit of custom code, see here which if you dig in does some fancy classloader tricks and makes some assumptions).
That said, if I add proxy support to Kobweb servers, you could start up a Kobweb server and ALSO spin up your custom server, and have Kobweb configured to point at it.
If you rebuild / restart your server, then you kind of get a live reloading experience, as the existing Kobweb server will just keep delegating to whatever is running.
set up my Kobweb server to act as a proxy for your server
This is how I currently use the Webpack Devserver:
So currently my Kotlin/JS webapp communicates directly only with the Devserver. It means I currently spin up 2 servers during development - and I have no problem with it :).
live reloading to work for your custom server probably won't ever happen
I see... The reason I want to give a try to Kobweb (besides that I already use the Modifier-system and other lower-level features) is that I'm not satisfied with how the Kotlin - Webpack Devserver integration works (or often not works in my case). I have already tried the generated "hello-world" Kobweb project but I want to try somehow how it would work with my complex multi-project application.
That said, if I add proxy support to Kobweb servers, you could start up a Kobweb server and ALSO spin up your custom server
This is exactly how I currently use the Webpack Devserver. It proxies everything to my backend except the generated JS files. So yes, it would probably work.
Just one question: wouldn't it be really big work to implement a HTTP+WS proxy from stratch? Or do you know a (Ktor-based) ready-to-integrate alternative?
Another idea has just popped in my head, namely to avoid HTTP/WS proxying entirely:
jsBrowserDevelopmentRun
with Kobweb tasks).If I allowed you to set up my Kobweb server to act as a proxy for your server
The reason I don't want you to implement this proxying functionality right now is because I'm not sure that I can successfully convert my app to Kobweb, and I don't want you to work unnecessarily. It is because my biggest problem is not the proxying: my webapp owns the entire application logic, starting from a suspend main()
function (it starts a DI container, makes various initializations, etc.), so it will be probably non-trivial to convert it to Kobweb - I don't know if I can do it at all :( (so currently I'm just collecting information about all related tasks, before even starting this huge refactoring).
But thanks for the insights, and giving me the above idea :)
To check off items on this list, they should both be supported AND documented
Static support
These items probably just need files to be exported a certain way
Dynamic support
These items probably need logic currently backed into the
kobweb/backend
codebase refactored out into a shareable JVM library and then implemented per targetOther
I'm not familar with these technologies at this point so they will require a bit more investigation to categorize / understand properly
Original comment: