Fork me on GitHub
#om-next
<
2016-10-13
>
stask10:10:04

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

stask10:10:10

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)

stask10:10:16

but it doesn’t sound right

levitanong11:10:02

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

stask11:10:38

@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

stask12:10:31

@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)

stask12:10:45

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