Fork me on GitHub
#pedestal
<
2017-04-12
>
julianwegkamp13:04:10

@bahulneel Regarding connection management for websockets: I implemented a defrecord that implements WebSocketConnectionListener and WebSocketListener

julianwegkamp13:04:38

this way you can store the ws session and refer to it in the callbacks

julianwegkamp13:04:01

it was just a short experiment and I think the code smells a bit

bahulneel13:04:19

Yeah, I've done a similar thing.

julianwegkamp13:04:20

@bahulneel is it similar to this snippet?

bahulneel13:04:30

Something like that, I actually used the ws-map provided in pedestal. This worked for me because all my messages have all the context in them.

bahulneel13:04:00

Still have to do some house work to keep the connection pool clean and it smells a bit also

julianwegkamp13:04:01

You mean that a client always sends its id as part of this context?

bahulneel15:04:07

well, actually when a client connects the server sends it an id.

PB16:04:43

Hey all. I feel rather dumb. Logs being logged with (io.pedestal.log/anylevel ….) are not showing up in my logfiles nor when the server is running. I have not modified the logback.xml or anything that I know of. Anybody know what this could be?

ddeaguiar16:04:10

@petr was your service created using the lein pedestal-service template?

ddeaguiar16:04:48

I could only guess that some lib is bringing in org.slf4j/slf4j-nop and you need to exclude it

PB16:04:56

Datomic.

PB16:04:58

I forgot about that

PB16:04:02

Thank you

ddeaguiar16:04:07

and you’ll be set

PB16:04:13

Sorry it’s been so long since I setup a new project

ddeaguiar16:04:29

no worries. It’s happened to me more than once 🙂

PB16:04:27

@ddeaguiar is it just org.slf4j/slf4j-nop

PB16:04:51

I have been looking at my other projects and I find:

org.slf4j/jcl-over-slf4j
org.slf4j/jul-to-slf4j
org.slf4j/log4j-over-slf4j
org.slf4j/slf4j-api
org.slf4j/slf4j-nop

ddeaguiar16:04:11

Here’s what I typically exclude

ddeaguiar16:04:30

[com.datomic/datomic-pro "0.9.5544" :exclusions [org.slf4j/slf4j-api
                                                 org.slf4j/slf4j-nop
                                                 org.slf4j/slf4j-log4j12
                                                 org.slf4j/log4j-over-slf4j
                                                 org.slf4j/jcl-over-slf4j
                                                 org.slf4j/jul-to-slf4j
                                                 org.clojure/clojure
                                                 commons-codec]

PB16:04:39

CLojure as well?!

ddeaguiar16:04:24

your project is already bringing in clojure

ddeaguiar16:04:38

I think I did that because I was using clojure 1.9

PB16:04:55

Fair enough

mtnygard16:04:03

I wish more projects used :scope "provided" for their Clojure dependency. That would let the library use its version but the application's version would automatically override it.

souenzzo17:04:47

I finally understood :provided

bahulneel18:04:53

@mtnygard I've never really understood how scopes work, is there a place I can go to learn?

bahulneel18:04:47

@ddeaguiar Would explain why I've had little success in finding documentation 🙂, thanks for the help.

ddeaguiar19:04:28

@bahulneel I more exact answer is that Lein uses https://github.com/cemerick/pomegranate under the covers. Pomegranate wraps Sonatype Aether. The scopes are Maven scopes (https://github.com/cemerick/pomegranate/blob/pomegranate-0.3.0/src/main/clojure/cemerick/pomegranate/aether.clj#L632). So the Maven docs are still a good place to look.

ddeaguiar19:04:37

And I suppose the :dependencies vector in project.clj is more precisely referred to as a vector of Maven coordinates.

deg20:04:31

Hey, so I just watched https://www.youtube.com/watch?v=_Cf-STRvFy8. Paul does a great job of presenting Vase, and I learned that there is a lot more power than I had realized in the vase/apis syntax (e.g. :params in the slide at 23:00). I've read the docs at https://github.com/cognitect-labs/vase/tree/master/docs, but haven't seen much of this. Are there more docs somewhere? (Or are we still at "read the source, Luke?) It would be great to even have a beginner doc that walks through the syntax bits presented in this video.