This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2015-09-25
Channels
- # admin-announcements (19)
- # alda (73)
- # announcements (1)
- # aws (16)
- # beginners (22)
- # boot (109)
- # cljs-dev (1)
- # clojure (79)
- # clojure-art (3)
- # clojure-czech (2)
- # clojure-russia (233)
- # clojure-sweden (2)
- # clojurescript (161)
- # clojurex (25)
- # core-async (2)
- # cursive (4)
- # datomic (11)
- # editors (17)
- # emacs (3)
- # funcool (4)
- # hoplon (72)
- # ldnclj (29)
- # off-topic (1)
- # om (9)
- # onyx (13)
- # reactive (10)
- # reagent (13)
- # yada (4)
Ok, so I'm new to websockets ( as well as clojure ). New enough to possibly be asking a very stupid question. But how are people using them? Do I open one and put everything I want in it within a map ?
@timfield: We’re using Sente which provides some higher level abstractions over websockets
But you can just send maps over the wire. You probably want to serialise it with something, either EDN or Transit are good options
What’s the context behind sending a map with the page state?
Is that everything that the page needs to render itself?
What else are you using on the frontend? Reagent/Om?
What I don't like about this idea tho, is that I'm making a few API requests to construct the page state, and if they are in a single map, then I need to wait for all my API requests to return with data before I can begin rendering
Context, Clojure on server is creating page state, sending page state via a websocket to ClojureScript
Agh, but what if those API requests wrote to the channel when ready, then my client listens to that channel and reacts based on its content
Have you looked at re-frame? It’s one way to do what you’re describing
re-frame looks rad. Next project for sure. For now I'm rolling with this setup; Single channel & single page state map. Both are passed down to quiescent components which can use the channel to trigger a change to the single page state map ( on the server ) which is then passed down again.
Ideal pulled from http://www.parens-of-the-dead.com/