Skip to content
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

How do I use {:format :fression} on server side? (or: no method in multimethod for fression connection) #46

Closed
retrogradeorbit opened this issue Feb 13, 2016 · 3 comments

Comments

@retrogradeorbit
Copy link

Got a system going with {:format :transit-json}, but now when I try to switch to fression with code like this:

(defn ws-handler [{:keys [ws-channel] :as req}]
  (go
    (println (<! ws-channel))
    (>! ws-channel {1 ["recieving you"]})))

...

(GET "/ws" []
       (wrap-websocket-handler ws-handler {:format :fression}))

The wrap-socket-handler fails with:

java.lang.IllegalArgumentException: No method in multimethod 'formatter*' for dispatch value: :fression

Are there any docs or examples of working fression client/server connections?

@jarohen
Copy link
Owner

jarohen commented Feb 14, 2016

Hi there - think this might be a typo: :fression -> :fressian?

James

@retrogradeorbit
Copy link
Author

Well that's embarrassing...
I was all excited this would fix it, but after changing to the correct spelling it still doesn't like it.

java.lang.IllegalArgumentException: No method in multimethod 'formatter*' for dispatch value: :fressian

For mor info, I've been testing it in this little test project:

https://github.com/retrogradeorbit/multiplayer/blob/master/src-cljs/multiplayer/core.cljs#L106

@retrogradeorbit
Copy link
Author

OK. I got this working by :requiring chord.format.fressian in the ns declaration (even though I don't directly use it). This seems to register the multimethod and then the :format :fressian works.

So

 (:require [chord.format.fressian :as fressian])

...

(GET "/ws" []
       (wrap-websocket-handler ws-handler {:format :fressian}))

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

2 participants