This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-12-31
Channels
- # adventofcode (15)
- # announcements (8)
- # babashka (16)
- # beginners (48)
- # braveandtrue (5)
- # calva (54)
- # cider (7)
- # clara (8)
- # clj-kondo (3)
- # cljdoc (3)
- # clojure (37)
- # clojure-europe (1)
- # clojure-italy (15)
- # clojure-losangeles (2)
- # clojure-nl (15)
- # clojure-uk (6)
- # clojurescript (145)
- # community-development (53)
- # cursive (20)
- # data-science (8)
- # datomic (23)
- # duct (2)
- # emacs (22)
- # fulcro (16)
- # gorilla (7)
- # graalvm (7)
- # hoplon (1)
- # malli (7)
- # off-topic (8)
- # rewrite-clj (2)
- # ring (9)
- # spacemacs (2)
- # specter (1)
- # tools-deps (25)
- # vrac (1)
sorry i have no idea about that
I'm trying to set up dynamic routing, but I'm hitting an error Invalid join, {:com. … g/current-route nil}"
Anyone else having issues with websocket server push? I’m getting an error at the Sente level about an invalid event when I try to do a server push. This is on latest Fulcro 3.1.1 and fulcro-websockets 3.0.5. I tested this when I first ported to F3 and it was working, but haven’t needed push until now and it’s not working for me.
Ok, I found the problem. Not sure if this is a bug or intended behavior, but either way I’ll document it here in case others run into the same issue. Previously, I had been using the push function on the websocket component (through the WSNet protocol). To avoid a circular dependency, I had to switch to using the push function that’s injected into the parser environment. Here’s the issue (bug?) - those functions are not the same, and expect different arguments. The WSNet implementation converts the message into a single vector in a format that can be picked up and handled by the client networking, then passes this to the underlying Sente send-fn. However, the push function injected into the parser environment is the raw Sente send-fn itself, so if you use it you have to do the message formatting yourself. In my case this was easy enough because I handle push in a single place in my code, so I just had to do the message formatting there. @tony.kay I think at a minimum we should document this better. I would also argue that this might be a bug and that the push function injected into the parser env should work the same way as WSNet one, if for no other reason than the current implementation leaks the abstraction over send-fn and requires the user to use a special key in their code which is brittle (if that key ever changes). Unless you know of a particular reason someone might need the raw Sente send-fn. If you agree, it’s an easy change and I would be happy to send a PR with the fix.
The wsnet protocol object is IN the env now, isn’t it? And it implements the WSNet protocol I thought
You’re right. And it does say the push fn in the environment is the same as the Sente send-fn. I must have missed that part when I first scanned the code.
and if yoy use something like mount
to create the websockets, you can access push via the protocol and that object directly, without using the env: https://github.com/fulcrologic/fulcro-websockets#connected-clients-and-server-push
Yeah, it is a bit confusing. Maybe rename the key to send-fn, to make the distinction clear? But that would be a breaking change, so not sure it’s worth it.
Yeah, I am using mount but had problems with circular dependencies. If you need to push in the context of a resolver/mutation, you pretty much have to use what’s injected into the pathom env. Because the WS component depends on the parser, which depends on your “model” namespaces containing resolvers/mutations, so they can’t depend on the WS component directly.