metosin / pohjavirta

Fast & Non-blocking Clojure wrapper for Undertow
169 stars 8 forks source link

Support Websockets #1

Open ikitommi opened 5 years ago

plexus commented 4 years ago

Here's a starting point: https://github.com/plexus/procflow/blob/master/src/procflow/http/websocket.clj

It assumes you're using reitit like this

["/ws" {:websocket {:on-connect procflow.http/on-connect
                                                     :on-receive procflow.http/on-receive
                                                     :on-close   procflow.http/on-close
                                                     :on-error   procflow.http/on-error}}]

Not optimized at all, probably still has serious bugs, and contains some obvious inefficiencies (e.g. it will match all non-websocket routes twice), but like I said it's a starting point.