Fork me on GitHub
Andreas Liljeqvist12:12:00

I am trying to use pathom with make-websockets. Given a random query(not defined a resolver), should I get a traceback with Pathom? I can only see fulcro stuff atm.

Andreas Liljeqvist12:12:50

Hmm. Since raise-response takes parser as input pathom might have run but just left something unexpected. Error Don't know how to create ISeq from: clojure.core.async.impl.channels.ManyToManyC

Andreas Liljeqvist14:12:34

Is it even possible to use pathom with fulcro websockets?


should be, to get the trace you have to ask for it (in you query), you query for :com.wsscode.pathom/trace and it will be provided, its not always there because there is a cost to compute and send it, so it should only be used for dev/debug

Andreas Liljeqvist14:12:23

On the client, must I use pfn/pathom-remote as :remote or is that optional?

Andreas Liljeqvist14:12:32

Asking because fw/make-websocket-networking have to be passed as remote


I never tried with websocket, you might need to do some work, what the pathom/remote does is implement the Fulcro remote interface to call a parser directly, I'm not familiar with websockets but I guess it uses a different interface, so you have to implement that


pathom/remote is only for local parsers, are you running your parser in the browser or in a service?

Andreas Liljeqvist14:12:42

Server using pathom to resolve. Client using fulcro with (fc/new-fulcro-client {:networking {:remote (fw/make-websocket-networking)}). Some example in pathom docs indicated one should setup pathom/remote as :remote on client

Andreas Liljeqvist14:12:21

But I have only set Pathom as parser on server


pathom/remote is just for local parsers (running on the browser)

Andreas Liljeqvist14:12:58

ok, so a standard fulcro client shouldn't have to do anything special? Only server?

Andreas Liljeqvist14:12:11

Ok, thanks for your help. Bummer though that fulcro-websockets doesn't work out of the box, as Pathom is highly encouraged by Fulcro. (Not a critique, just a statement)


yeah, its a mater of usage I think, we are a very limited number of people working on those, so we prioritise things we are currently using, just happen that websockets are not so much a requirement in most cases, so it needs more love, I can help you answering questions if you like to make that easier, its certainly desirable (maybe just need better docs), just didn't got prioritised yet 🙂

Andreas Liljeqvist11:12:40

Certainly makes sense to implement for the most people. On the other hand Tony thinks it should work, so I am probably doing something wrong

Björn Ebbinghaus14:12:16

I use an API client library, which returns core.async channels. Is there a prefered way to use async channels in mutations? Is it bad, if the state change happens asynchronous?


your mutation local code should only do sync things changing the local, any async operation should be delegated to the remote, that you can use async as you will wish (use mutation returns or other loads to sync that back on your app db later)


if you are using pathom on the client it can handle async operations and integrate nicely with fulcro


@andreas862 I’m using pathom with websockets on 3 projects, I think


(def parser
    {::p/mutate     server/server-mutate
     ::p/fail-fast? false
     ::p/plugins    [(p/env-wrap-plugin (fn [env]
                                          (assoc env ::pc/indexes @indexes
                                                     :config s.config/config
                                                     :sql-dbspec {:dbtype     "postgresql"
                                                                  :datasource (:ucv s.sql/connection-pools)}
                                                     :connection s.database/connection)))
                     (p/env-plugin {::p/reader               [p/map-reader
                                                              (p/placeholder-reader ">")]
                                    ::p/placeholder-prefixes #{">"}
                                    ::pc/resolver-dispatch   resolver-fn
                                    ::p/process-error        process-error})
                     (preprocess-parser-plugin log-requests)
                     (preprocess-parser-plugin add-current-info)
                     (p/post-process-parser-plugin p/elide-not-found)]}))
(:require             [fulcro.websockets :as fw])

(defstate websockets
  (let [websockets (fw/make-websockets
                     {:http-server-adapter (get-sch-adapter)
                      :sente-options       {:user-id-fn user-id-fn}})]
    (component/start websockets))
  (component/stop websockets))

Andreas Liljeqvist11:12:44

Thanks! Of course my problem was that I used the parallell-parser. Now to learn the rest of Pathom..


Have not upgraded to latest Sente…it has bug fixes for csrf (that my code works around…I reported the security hole in Sente)…there is an open issue to make sure the upgrade works, but perhaps that is your problem?


How to use @keyframes in co-css in cljs?


@eric.shao See garden docs…you have to declare them outside


don’t remember the details…


there’s like a defkeyframes or something


search for keyframes


@tony.kay Thank you. find it.

(defkeyframes my-animation
   {:background "red"}]

   {:background "yellow"}])

  my-animation ;; Include the animation in the stylesheet.
   {:animation [[my-animation "5s"]]}])"