<commit_before>(ns rksm.websocket-test.simple-sender
  (:require [chord.client :refer [ws-ch]]
            [cljs.core.async :refer [<! >! put! close!]])
  (:require-macros [cljs.core.async.macros :refer [go]]))

(.log js/console "barrrr?")

(go
 (js/console.log "foooo?")
 (let [{:keys [ws-channel error]} (<! (ws-ch "ws://localhost:8081"))]
   (if-not error
     (do (>! ws-channel "Hello server from client!")
       (loop []
         (if-let [{:keys [message error]} (<! ws-channel)]
           (if error
             (js/console.log "Connection error:" error)
             (do
               (.log js/console "Got message from server:" (pr-str message))
               (recur)))
           (js/console.log "Connection closed")))
       )
     (js/console.log "Error:" (pr-str error)))))<commit_msg>fooling around ... and it works :)<commit_after>(ns rksm.websocket-test.simple-sender
  (:require [cljs.core.async :refer [put! chan <! >! timeout]])
  (:require-macros [cljs.core.async.macros :refer (go)]))

(def c (chan))


(go 
 (<! (timeout 1000))
 (go (>! c "test"))
    ) 

(go (js/console.log (<! c)))

(comment 
 (async/go
  (js/console.log "foooo?")
  (let [{:keys [ws-channel error]} (<! (ws-ch "ws://localhost:8081"))]
    (if-not error
      (do (>! ws-channel "Hello server from client!")
        (loop []
          (if-let [{:keys [message error]} (<! ws-channel)]
            (if error
              (js/console.log "Connection error:" error)
              (do
                (.log js/console "Got message from server:" (pr-str message))
                (recur)))
            (js/console.log "Connection closed")))
        )
      (js/console.log "Error:" (pr-str error))))))

(comment (ns rksm.websocket-test.simple-sender
  (:require [chord.client :refer [ws-ch]]
            [cljs.core.async :refer [<! >! put! close!]])
  (:require-macros [cljs.core.async.macros :refer [go]]))

(.log js/console "barrrr?")

(go
 (js/console.log "foooo?")
 (let [{:keys [ws-channel error]} (<! (ws-ch "ws://localhost:8081"))]
   (if-not error
     (do (>! ws-channel "Hello server from client!")
       (loop []
         (if-let [{:keys [message error]} (<! ws-channel)]
           (if error
             (js/console.log "Connection error:" error)
             (do
               (.log js/console "Got message from server:" (pr-str message))
               (recur)))
           (js/console.log "Connection closed")))
       )
          (js/console.log "Error:" (pr-str error)))))
)
{'fraction_non_alphanumeric': 0.19469026548672566, 'fraction_numerical': 0.006436041834271922, 'mean_word_length': 2.2896825396825395, 'pattern_counts': {'":': 0, '<': 14, '<?xml version=': 0, '>': 10, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4512', 'n_tokens_mistral': 886, 'n_tokens_neox': 838, 'n_words': 202}