drapanjanas / pneumatic-tubes

WebSocket based transport of events between re-frame app and server
Eclipse Public License 1.0
58 stars 7 forks source link

Help with server-side event handle #10

Closed andrewzhurov closed 6 years ago

andrewzhurov commented 6 years ago

Hello, I'm building a web app, got confused by a situation below, would appreciate any helpful suggestions

App runs at: http://dev.brawl.haus on login event dispatches successfully (logged in console) Locally it proceeds fine, however on a cloud machine it fails on server side event handle with error below

Exception in thread "async-dispatch-60" java.lang.IllegalArgumentException: No implementation of method: :close! of protocol: #'clojure.core.async.impl.protocols/Channel found for class: clojure.lang.PersistentVector
        at clojure.core$_cache_protocol_fn.invokeStatic(core_deftype.clj:568)
        at clojure.core$_cache_protocol_fn.invoke(core_deftype.clj:560)
        at clojure.core.async.impl.protocols$fn__400$G__393__405.invoke(protocols.clj:21)
        at clojure.core.async.impl.ioc_macros$run_state_machine_wrapped.invokeStatic(ioc_macros.clj:1018)
        at clojure.core.async.impl.ioc_macros$run_state_machine_wrapped.invoke(ioc_macros.clj:1014)
        at pneumatic_tubes.core$receive$fn__6237.invoke(core.clj:118)
        at clojure.lang.AFn.run(AFn.java:22)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
        at java.lang.Thread.run(Thread.java:748)

And such happens on server start:

Exception in thread "async-dispatch-149" java.lang.ClassCastException: clojure.core.async.impl.buffers.FixedBuffer cannot
 be cast to java.util.Iterator
        at clojure.core.async.impl.channels.ManyToManyChannel$fn__639.invoke(channels.clj:87)
        at clojure.core.async.impl.channels.ManyToManyChannel.put_BANG_(channels.clj:86)
        at clojure.core.async.impl.ioc_macros$put_BANG_.invokeStatic(ioc_macros.clj:1031)
        at clojure.core.async.impl.ioc_macros$put_BANG_.invoke(ioc_macros.clj:1030)
        at pneumatic_tubes.core$dispatch$fn__6317$state_machine__4322__auto____6318$fn__6320.invoke(core.clj:140)
        at pneumatic_tubes.core$dispatch$fn__6317$state_machine__4322__auto____6318.invoke(core.clj:139)
        at clojure.core.async.impl.ioc_macros$run_state_machine.invokeStatic(ioc_macros.clj:1012)
        at clojure.core.async.impl.ioc_macros$run_state_machine.invoke(ioc_macros.clj:1011)
        at clojure.core.async.impl.ioc_macros$run_state_machine_wrapped.invokeStatic(ioc_macros.clj:1016)
        at clojure.core.async.impl.ioc_macros$run_state_machine_wrapped.invoke(ioc_macros.clj:1014)
        at pneumatic_tubes.core$dispatch$fn__6317.invoke(core.clj:139)
        at clojure.lang.AFn.run(AFn.java:22)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
        at java.lang.Thread.run(Thread.java:748)

Repo: https://github.com/andrewzhurov/brawl-haus Event dispatch: https://github.com/andrewzhurov/brawl-haus/blob/master/src/cljs/brawl_haus/panels/login.cljs#L14 Tube registration: https://github.com/andrewzhurov/brawl-haus/blob/master/src/clj/brawl_haus/server.clj#L209 Modified webhook-handler: https://github.com/andrewzhurov/brawl-haus/blob/master/src/clj/brawl_haus/my_tubes.clj#L30 (only differs in arguments) (needed that on-tube-close)

The lib is a ton of fun to play with! Event execution in context of server seems much useful Looks like the right step we put our state into - server! No need to poke and sync, we can propagate state from truly top of our apps :fire: :relaxed:

andrewzhurov commented 6 years ago

Uf, nevermind, probably lein compile had done something, works great on fresh lein repl