Skip to content
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
Cannot retrieve contributors at this time
(ns birdwatch.core
"This is the main namespace of the client side of BirdWatch. It is written in
ClojureScript and makes use of the systems-toolbox library
( for building and wiring
components. Below, a switchboard is created, which is a specialized component
for wiring components together so that messages flow through a system."
(:require [matthiasn.birdwatch-specs.specs]
[ :as cloud]
[birdwatch.ui.ui :as ui]
[birdwatch.state.comp :as state]
[ :as sb]
[ :as sente]
(defonce switchboard (sb/component :client/switchboard))
(defn make-observable [components]
(let [mapper #(assoc-in % [:opts :msgs-on-firehose] true)]
(set (mapv mapper components))))
(defn init []
(let [ws-cfg {:relay-types #{:cmd/query :cmd/percolate}}
sente-firehose-cfg {:opts {:in-chan [:buffer 100]}}
cmps #{(sente/cmp-map :client/ws-cmp ws-cfg)
(state/cmp-map :client/state-cmp)
(sente/cmp-map :client/ws-firehose sente-firehose-cfg)
(ui/cmp-map :client/ui-cmp)}
cmps (make-observable cmps)]
[[:cmd/init-comp cmps]
[:cmd/route {:from #{:client/state-cmp
:to :client/ws-cmp}]
[:cmd/route {:from #{:client/ws-cmp
:to :client/state-cmp}]
{:from :client/state-cmp
:to #{:client/ui-cmp}}]
[:cmd/attach-to-firehose :client/ws-firehose]])))