Skip to content

error on build client first step #4

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
tlightsky opened this issue Mar 4, 2015 · 0 comments
Open

error on build client first step #4

tlightsky opened this issue Mar 4, 2015 · 0 comments

Comments

@tlightsky
Copy link

Error:
Uncaught Error: No protocol method ICollection.-conj defined for type cljs.core.async.impl.channels/ManyToManyChannel: [object Object]

Code below is in websocket.cljs

(ns async-workshop.chat-demo.client.web-socket
  (:require [goog.events :as ev]
            [om.core :as om :include-macros true]
            [cljs.core.async :as async :refer [<! chan >! put!]]            
            [om.dom :as dom :include-macros true])
  (:require-macros [cljs.core.async.macros :refer [go-loop]])
  (:import goog.net.WebSocket))
(def socket-chan (chan))

(defn ^:private make-init-state
  []
  (let [socket (WebSocket.)]
    (ev/listen socket
               #js [WebSocket.EventType.CLOSED
                    WebSocket.EventType.ERROR
                    WebSocket.EventType.MESSAGE
                    WebSocket.EventType.OPENED]
               (fn [e]
                 (.log js/console (.-type e))
                 (put! socket-chan (.-type e))
                 ))
    {:socket socket}))

(defn ^:private socket-state-loop [global-state]
  (go-loop []
    (when-let [msg (<! socket-chan)]
      (.log js/console msg)
      (recur))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant