Explorar o código

small updates

Harlan Iverson %!s(int64=8) %!d(string=hai) anos
pai
achega
ef1261c0d9

+ 1 - 0
project.clj

@@ -28,6 +28,7 @@
             :versions {com.github.harlanji.clojure-stack/core "0.0.1-SNAPSHOT"
                        com.github.harlanji.clojure-stack/pubsub-service "0.0.1-SNAPSHOT"
                        com.analogzen.clojure-stack/web-client "0.0.1-SNAPSHOT"
+                       com.analogzen.clojure-stack/web-backend "0.0.1-SNAPSHOT"
 
 
                        ; idea: automatically insert module versions

+ 1 - 1
web-backend/src/example/core.clj

@@ -23,7 +23,7 @@
         (sente/make-channel-socket! sente-web-server-adapter {})]
     (go (while true
           (let [event (<! ch-recv)]
-            (println "event:" event))))
+            (println "event:" (:id event)))))
     (fn [req]
       (when (= (:uri req) uri)
         (println "Starting sente session.")

+ 3 - 1
web-client/project.clj

@@ -32,6 +32,8 @@
 
             ; opinion: dev should be a layer on top of prod. system-map can be updated by dev accordingly, before (start)
             :profiles {:dev {:plugins [[lein-figwheel "0.5.0-4"]]
+                             :dependencies [;;;[com.analogzen.clojure-stack/web-backend _]
+                                            ]
                              :cljsbuild {:builds {:dev {:source-paths ["src" "dev-src"]
 
                                                         ; if only we could copy these from core...
@@ -56,6 +58,6 @@
                                                                    :css-dirs ["resources/public/css"]
                                                                    :on-jsload example.dev/reload!
                                                                    ;;; :ring-init example.dev/init! -- no such option
-                                                                   ;:ring-handler example.dev/app
+                                                                   ;;;:ring-handler example.core/app
                                                                    }}}}}}
             :min-lein-version "2.5.0")

+ 2 - 1
web-client/resources/public/index.html

@@ -1,6 +1,7 @@
 <!DOCTYPE html>
 <html>
-<head></head>
+<head>
+</head>
 <body>
 hi! Check out the console.
 

+ 3 - 2
web-client/src/example/core.cljs

@@ -10,7 +10,7 @@
 (defrecord App [sente]
   component/Lifecycle
   (start [component]
-    (.info js/console "App started. sente=" sente)
+    (.info js/console "App started. :) :) sente=" sente)
     component)
   (stop [component]
     (.info js/console "App stopped.")
@@ -45,11 +45,12 @@
   component/Lifecycle
   (start [c]
     (let [sente-chsk (sente/make-channel-socket! "/chsk" {:type :auto
+                                                          :host "localhost:3000" ; FIXME only in figwheel
                                                           :client-id (:client-id env)})
           c (assoc c :sente-chsk sente-chsk)]
       (go (while true
             (let [event (<! (:ch-recv sente-chsk))]
-              (.info js/console (str "Got event! " event)))))
+              (.info js/console (str "Got event! " (:id event))))))
       (.info js/console "Sente started. client-id=" (:client-id env))
 
       (.setTimeout js/window #((:send-fn sente-chsk) [:client/hi]) 500)