This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-12-11
Channels
- # adventofcode (116)
- # aleph (10)
- # announcements (2)
- # beginners (67)
- # boot (3)
- # calva (17)
- # cider (8)
- # cljdoc (27)
- # cljsrn (6)
- # clojure (144)
- # clojure-austin (3)
- # clojure-boston (1)
- # clojure-dev (25)
- # clojure-europe (4)
- # clojure-italy (26)
- # clojure-losangeles (4)
- # clojure-nl (28)
- # clojure-russia (1)
- # clojure-uk (34)
- # clojurescript (130)
- # cursive (20)
- # datomic (69)
- # emacs (14)
- # figwheel-main (2)
- # fulcro (31)
- # graphql (3)
- # hyperfiddle (3)
- # jobs (1)
- # jobs-discuss (1)
- # kaocha (1)
- # leiningen (2)
- # lumo (2)
- # nrepl (1)
- # off-topic (182)
- # onyx (5)
- # re-frame (88)
- # reagent (12)
- # reitit (2)
- # ring-swagger (13)
- # shadow-cljs (136)
- # tools-deps (28)
- # vim (4)
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.
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
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
On the client, must I use pfn/pathom-remote
as :remote
or is that optional?
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?
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
But I have only set Pathom as parser on server
pathom/remote
is just for local parsers (running on the browser)
ok, so a standard fulcro client shouldn't have to do anything special? Only server?
yes, correct
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 🙂
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
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/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
pc/reader2
pc/ident-reader
(p/placeholder-reader ">")]
::p/placeholder-prefixes #{">"}
::pc/resolver-dispatch resolver-fn
::p/process-error process-error})
p/request-cache-plugin
pp/profile-plugin
p/error-handler-plugin
(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
:start
(let [websockets (fw/make-websockets
s.parser/parser
{:http-server-adapter (get-sch-adapter)
:sente-options {:user-id-fn user-id-fn}})]
(component/start websockets))
:stop
(component/stop websockets))
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?
@eric.shao See garden docs…you have to declare them outside