luminus

plins 2019-07-31T01:28:29.036600Z

Immutant maintainer dropped the project and its future is uncertain

eskemojoe007 2019-07-31T13:20:11.037300Z

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

doesntmeananything 2019-07-31T14:30:11.041300Z

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:

2019-07-31T14:38:12.042100Z

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

2019-07-31T14:39:26.042300Z

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

2019-07-31T14:39:47.042800Z

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

2019-07-31T14:40:31.043400Z

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

2019-07-31T14:42:01.045Z

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.

doesntmeananything 2019-07-31T14:50:57.045100Z

Thank you very much! Tinkering now...

erwinrooijakkers 2019-07-31T15:01:57.046400Z

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.

plins 2019-07-31T20:50:10.050600Z

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

👍 1