Fork me on GitHub
#ring
<
2017-01-17
>
sova-soars-the-sora22:01:45

Is there a definitive "how to install http kit from the ground-up" or "how to replace your current run-jetty with run-server" guide?

sova-soars-the-sora22:01:33

I ask because I'm moving my setup (ring on the backend w/ compojure) to use HTTP Kit so I can use Sente (websockets) and... I'm not certain where the heck ring invokes jetty-server, nor am I sure how to replace that with a call to run-server (from httpkit)

seancorfield22:01:15

How do you normally start your server up?

seancorfield22:01:31

(since you don’t seem to think your code is calling the run-jetty function, I suspect you’re relying on a plugin or you’re building an uberjar via a plugin?)

seancorfield22:01:29

The “simple” answer is that you’ll need a -main that requires the http-kit namespace and calls run-server directly (and then “waits around” — by default Jetty starts and joins the main thread so your program automatically waits for Jetty to shutdown; http-kit starts in the background and you have to do something to wait around yourself).

seancorfield22:01:39

If you’re using Stuart Sierra’s Component library to manage the start/stop lifecycle, you may find this example helpful: https://github.com/framework-one/fw1-clj/blob/master/examples/usermanager/main.clj#L91-L126

seancorfield22:01:05

It uses a runtime option to decide whether to start Jetty or start http-kit, and it also has the shutdown code.