om-next

stask 2016-10-13T10:13:04.000278Z

hi, probably newbie question, but i couldn’t find the answer. what is the idiomatic way for om.next to update clients about server state changes? i have a simple web client where i implemented mutate and read. And a simple server with mutate and read. Everything works fine with one client. I now want to see the changes made by one client in another client. Something with SSE

stask 2016-10-13T10:15:10.000280Z

i can of course implement some proprietary protocol, where server will send updates to all connected clients and clients will perform transact! that will only update the client (and will not send anything to remote)

stask 2016-10-13T10:15:16.000281Z

but it doesn’t sound right

levitanong 2016-10-13T11:57:02.000283Z

@stask I normally define a custom :merge option in the reconciler, but nowadays, I find there’s nothing wrong with using transact!

stask 2016-10-13T11:58:38.000284Z

@levitanong i’m trying to do it now using om.next/merge!, feels like that’s the right way to do it, but we’ll see 🙂, thanks

stask 2016-10-13T12:06:31.000285Z

@levitanong so yeah, it kind of works. i’m posting results of mutation to an updates channel on server. When client opens EventSource to the server, i tap another channel to the mult created from that updates channel. The client then takes the :result value and calls

(om.next/merge! reconciler novelty)

stask 2016-10-13T12:06:45.000286Z

still not sure thats the right way to do it but it works now 🙂