Immutant maintainer dropped the project and its future is uncertain
That's too bad. I don't think sente has an attachment for Jetty though.
@david.folkner https://github.com/ptaoussanis/sente/issues/102
Can anyone give me a few pointers? I'm very new to clojure and I'm trying to create a simple but fairly feature-full websocket chat app based on luminus, however I'm stuck at trying to display the active users in the chat. Basically, on the client I'm initiating atoms that contain users and messages and update them through when someone logs in or types a message. The issue is I'm not sure how to update the user atom over time in such a way as to correctly display multiple users and remove them when they leave This is what I have at the moment:
I recommend you use a Clojure set for your users — add new users with conj
and remove them with disj
(defonce users (atom #{}))
=> #'user/users
(swap! users conj :joe)
=> #{:joe}
(swap! users conj :bill)
=> #{:bill :joe}
(swap! users disj :bill)
=> #{:joe}
You’re using Reagent atoms instead of regular atoms, but it’ll work the same.
And I used :joe
and :bill
, but you can use the full user record
Alternately you may need to set up your users like a kind of mini database, with a username as a key and the full user record as the value, so a hashmap would be a good choice there. If you don’t need that amount of complexity, though, a set will be simpler.
Thank you very much! Tinkering now...
How can we specify the type of object in the Swagger UI when we spec it using a set as a predicate? It now states type is object
, while is should be the type of the elements in the set (`string`). What we tried is adding :type
key to spec-tools/spec as a string, keyword and class, but all didn’t work.
If im not mistaken, (s/def ::s (s/and #(pos? (count %)) string?)
wont display string
but (s/def ::s (s/and string? #(pos? (count %)) )
will, so maybe if you rearrange the spec ordering it will show up properly