Fork me on GitHub
#graphql
<
2022-04-06
>
vlaaad12:04:00

I’m still working on the batching query execution engine, but there is already a repo: https://github.com/vlaaad/plusinia You can have a look at tests for some examples. It works! Batches by field+args, supports interfaces and unions…

2
vlaaad12:04:54

I’m talking about this

timrichardt14:04:13

Hey! I have an issue with re-graph subscriptions. After subscribing, I actually get the first message via websocket, but then no more events. It seems, that the value :subscriptions of app-db is just an empty map (see screenshot), and does not contain the subscription, as I think it should be (concluding from https://github.com/oliyh/re-graph/issues/42).

(re-frame/reg-event-db
 ::on-thing
 [(when ^boolean goog.DEBUG re-frame/debug)]
 (fn [db [_ {:keys [data errors] :as payload}]]
   (js/console.log "message:" payload)
   (js/console.log "db:" (clj->js db))
   db))

(re-frame/dispatch-sync
   [::re-graph/init
    {:ws {:url                     (str ")
          :sub-protocol            "graphql-ws"
          :reconnect-timeout       500
          :resume-subscriptions?   true
          :connection-init-payload {:token account
                                    :csrf  csrf}
          :impl                    {:headers {"Authorization"      (str "Bearer " account)
                                              "Authorization-CSRF" csrf}}
          :supported-operations    #{:subscribe
                                     :query
                                     :mutate}}

     :http {:url                  ""
            :impl                 {:headers {"Authorization"      (str "Bearer " account)
                                             "Authorization-CSRF" csrf}}
            :supported-operations #{:query
                                    :mutate}}}])

(re-frame/dispatch-sync [::re-graph/subscribe
                           :my-subscription-id
                           MESSAGES_SUBSCRIPTION
                           {:targetIds ["ZKFETo4fAfHMuCAfXrud1AKhq5MMm4akpqcb5T8qjgxSFaShyUZYCEH65755"]}
                           [::on-thing]])

timrichardt14:04:02

:ready? is true , as it is supposed to be, I think.

oliy17:04:46

The state of re-graph looks correct

oliy17:04:06

If you inspect the websocket from the network tab, what messages do you see?

oliy17:04:09

My guess at the moment is your subscription is finishing and sending a stop message down the websocket, which results in the subscription being cleaned up

gklijs19:04:24

Not sure it's of any help, but this is an example of subscriptions working, https://github.com/gklijs/bkes-demo.

🙏 1
timrichardt13:04:06

Thank you for your hints! It really was the case, that the stream sent a {type: "complete"} message and subscription subsequently ended.

oliy18:04:28

Thanks for the closure :)

🙂 1