Questions tagged [http-kit]

HTTP Kit is a minimalist, efficient, Ring-compatible HTTP client/server for Clojure. It uses a event-driven architecture to support highly concurrent a/synchronous web applications. Feature a unified API for WebSocket and HTTP long polling/streaming.

HTTP Kit is a minimalist, efficient, Ring-compatible HTTP client/server for Clojure. It uses a event-driven architecture to support highly concurrent a/synchronous web applications. Feature a unified API for WebSocket and HTTP long polling/streaming

Information from: http://http-kit.org/

68 questions
2
votes
1 answer

How do I simplify Compojure routes?

I have the following code to define my routes in Compojure: (ns my-project.my-test (:gen-class) (:require [my-test.template-views :refer :all] [compojure.core :refer [defroutes GET POST context]] [compojure.route :as route] …
Darrell Brogdon
  • 6,843
  • 9
  • 47
  • 62
2
votes
0 answers

Clojure: how to authenticate web socket user?

I was following the http-kit websockets example and later got stuck trying to find an idiomatic way to map WS channels to users on the backend. I've tried to inspect org.httpkit.server.AsyncChannel object using Java reflection and got the following…
BinaryButterfly
  • 18,137
  • 13
  • 50
  • 91
2
votes
2 answers

How can I forward part of requests to another server in Clojure?

Summary I am developing a server to be like a sort of a proxy in Clojure, with pedestal service + lein as a base: Receive requests Forward requests to external servers Make multiple requests server-to-server to feed a bigger json and return as a…
2
votes
0 answers

How exactly are POST request bodies processed in Clojure? (http-kit, compojure)

I have a page with a login form, and a server that accepts POST requests. Here is the server: (ns clj_server.core (:require [org.httpkit.server :refer [run-server]] [compojure.core :refer [defroutes POST]] [compojure.route…
Agent 008
  • 141
  • 8
2
votes
1 answer

Can't catch exception in clojure ring app

I'm working on my shopping app and I'm trying to make a custom exception handler, but there's something else that's catching them before I get to them! Here is my handler (defn wrap-fallback-exception [handler] (fn [request] (try+ …
Kingfranz
  • 184
  • 1
  • 12
2
votes
0 answers

clojure http-kit failure on ssl

The trouble I am facing is hard to debug as it doesn't offer much of an explanation in the stack trace. What I am trying to do is retrieve an oAuth token using a key and a secret provided to me. When using postman it works just fine meaning the…
sqwale
  • 554
  • 3
  • 24
2
votes
1 answer

Clojure reloaded workflow without using library like Component?

So I have a simple webapp that has a main method that starts an http server. The dev setup that I want to achieve is basically something like using lein auto, but I want to stop and start my server and reload namespaces automatically on file…
2
votes
1 answer

How to mock test POST requests with body as JSON using ring mock request?

I am using http-kit as the server with wrap-json-body from ring.middleware.json to get the stringified JSON content sent from the client as the request body. My core.clj is: ; core.clj ; .. (defroutes app-routes (POST "/sign" {body :body} (sign…
user235273
2
votes
2 answers

How to set Content-Type as application/json in httpkit

I use httpkit as http client. I try many solutions to make the header Content-Type be application/json, but all failed. Here is my code: (require '[org.httpkit.client :as http]) (http/post url { :query-params {"q" "foo, bar"} :form-params…
keroro520
  • 459
  • 4
  • 12
2
votes
1 answer

Using http-kit long polling with core.async channels

I have some long running process that returns a core.async channel with the result on it when the process has finished. Now I'd like to return that result using long-polling with HTTP-kit. Unfortunately I'm a bit confused what the right way of…
JoelKuiper
  • 4,362
  • 2
  • 22
  • 33
2
votes
1 answer

Synchronous POST with http-kit in clojure

I am trying to do use the http-kit client library in clojure to do synchronous posts returning promises. Is there any way to limit the number of threads doing the actual post? All the examples I could find of using the inbuilt thread pool use the…
ducky
  • 1,113
  • 1
  • 11
  • 23
1
vote
1 answer

How to make session data in http-kit

For my login system, I need to implement session data for different functionality when users are logged in or not. I've only ever done sessions in flask, and google searches don't reveal a lot (or, more likely, I'm searching the wrong things). I…
Jack Gee
  • 136
  • 6
1
vote
0 answers

403 when testing local post request using clj-http

I have a route defined as: (POST "/login" [req] req) in my httpkit server. I wanted to test this route so I tried to use: (client/post "http://localhost:3000/login" {}) using clj-http.client, but I just get error 403 (forbidden) when I attempt to…
Jack Gee
  • 136
  • 6
1
vote
2 answers

How to embed the current git sha in a URL route in Clojure

Typically I have a URL GET route for all of my server-side applications that returns the current git hash as an easy way to check the exact version of the code running on a given instance. In interpreted languages (e.g. Python, Node.js) this is…
Jared Smith
  • 19,721
  • 5
  • 45
  • 83
1
vote
1 answer

Nginx without Docker connecting to docker container (clojure)

I'm new to webapps and nginx in particular. My default.conf looks like this listen 80; return 301 https://$host$request_uri; } server { server_name ; location / { root /usr/share/nginx/html; …