Fork me on GitHub
#re-frame
<
2016-02-20
>
drapanjanas12:02:07

Has anyone implemented re-frame event routing to the server via websocket, and having re-frame-like api on server side to register handlers for these events? I would like to be able processing some events both on client and server while server side handler implementation would dispatch new events to the one or many clients. Is something like this already available?

darwin12:02:29

@drapanjanas: why websocket? I’m waiting for om.next, which will likely replace my current combo re-frame+reagent. Maybe look into om.next how they do state transition, on client side (optimistically) and server side

drapanjanas13:02:10

Well, I am quite happy how re-frame model works on client, so thought of extending same event model to the server side. Nothing fancy just seamless event routing and a possibility of dispatching re-frame compatible events asynchronously from server

drapanjanas13:02:00

websocket just as a transport layer for events

drapanjanas13:02:09

@darwin I will definitely have a closer look to om.next, can not reason about it now. Does it implements some kind of server push too?

hoopes20:02:23

hi - i have a beginner question. looking at the todomvc example, each subscription function takes the global app state in the db argument - but where is it defined that the global app state it receives is the one defined in db.cljs ? Does that question even make sense?

hoopes20:02:19

i read that actually simple_smile i see the initialize-db handler that’s called on init, which returns the merged value of default value and what comes from local storage…. is that a blessed handler or something? i know i’m missing something obvious here, sorry

hoopes20:02:50

oh dang - is the return value from the handlers the new state of the app db?

hoopes20:02:43

and then i was looking at https://github.com/Day8/re-frame/wiki/A-Larger-App#larger-apps wondering if that meant a smaller db per panel, but that just handles data operations, and re-frame gives you the top-level global app-db

kanwei20:02:31

yeah the return value of the handler is the new app-state

kanwei20:02:43

so make sure you return an app-state even if you're doing side effects

hoopes21:02:12

got it, that’s fantastic. and now :initialize-db actually makes sense now too. thanks to all!