See the ws route below. I understand that the route is not set up to handle websocket connections. Also when I visit using the url using a regular browser window, I know it will fails. But I expect the httpkit/websocket? to work as described on page https://http-kit.github.io/http-kit/org.httpkit.server.html#var-websocket.3F Would that now print outfalse. But instead I get an error saying: java.lang.IllegalArgumentException: No implementation of method: :websocket? of protocol: #'org.httpkit.server/Channel found for class: clojure.lang.PersistentHashMap.I am very new to clojure. Just trying to figure out what to use for webapps.
I believe you need to pull out the channel linked to the request to get web-sockets with http-kit. There seems to be an example here: https://http-kit.github.io/server.html#channel
http-kit.github.io
HTTP server | http-kit, high performance HTTP Client/Server for Clojure
Event-driven I/O HTTP Client & Server for Clojure: small, efficient, Ring-compatible. Asynchronous and websocket supported
Test This 6 hours ago
Examples of using reitit, ring and http-kit where one or more routes provide a websocket
reitit repository examples: https://github.com/metosin/reitit/tree/master/examples
reitit + ws - mount a ws-endpoint into a route
See the ws route below. I understand that the route is not set up to handle websocket connections. Also when I visit using the url using a regular browser window, I know it will fails. But I expect the httpkit/websocket? to work as described on page https://http-kit.github.io/http-kit/org.httpkit.server.html#var-websocket.3F Would that now print out
false
. But instead I get an error saying: java.lang.IllegalArgumentException: No implementation of method: :websocket? of protocol: #'org.httpkit.server/Channel found for class: clojure.lang.PersistentHashMap.I am very new to clojure. Just trying to figure out what to use for webapps.I believe you need to pull out the channel linked to the request to get web-sockets with http-kit. There seems to be an example here: https://http-kit.github.io/server.html#channel http-kit.github.io HTTP server | http-kit, high performance HTTP Client/Server for Clojure Event-driven I/O HTTP Client & Server for Clojure: small, efficient, Ring-compatible. Asynchronous and websocket supported Test This 6 hours ago
I believe the linked approach is deprecated. However, the example given here: https://http-kit.github.io/http-kit/org.httpkit.server.html#var-as-channel, works well. It appears that my mistake was using (httpkit/websocket?, when, in fact, I was supposed to be using just (:websocket? ).