Fork me on GitHub
#luminus
<
2019-07-31
>
plins01:07:29

Immutant maintainer dropped the project and its future is uncertain

eskemojoe00713:07:11

That's too bad. I don't think sente has an attachment for Jetty though.

doesntmeananything14:07:11

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:

manutter5114:07:12

I recommend you use a Clojure set for your users — add new users with conj and remove them with disj

manutter5114:07:26

(defonce users (atom #{}))
=> #'user/users
(swap! users conj :joe)
=> #{:joe}
(swap! users conj :bill)
=> #{:bill :joe}
(swap! users disj :bill)
=> #{:joe}

manutter5114:07:47

You’re using Reagent atoms instead of regular atoms, but it’ll work the same.

manutter5114:07:31

And I used :joe and :bill, but you can use the full user record

manutter5114:07:01

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.

doesntmeananything14:07:57

Thank you very much! Tinkering now...

erwinrooijakkers15:07:57

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.

plins20:07:10

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

👍 4