taoensso / sente

Realtime web comms library for Clojure/Script
https://www.taoensso.com/sente
Eclipse Public License 1.0
1.73k stars 193 forks source link

Sending records over sente #367

Closed Folcon closed 2 years ago

Folcon commented 4 years ago

So sente is awesome =)... I've been sending records over websockets and I've muddled through enough that things appear to be working, however payload sizes are slowly going up so the next step is sending state diffs across and patching things on the client side.

I'm doing diff/patch via editscript and I've finally gotten send state working in repl, my approach for now is pretty simple, I keep the last 100 diffs then get the client to tell me what the last diff they saw is, then I send them a vector of diffs to get them up to date. That in general appears to keep the clients only 1 tick behind.

However for some reason that I've not been able to pin down yet, this approach immediately breaks over sente, I don't believe it's sending the records over, as I can do that, but when I use the diffs that doesn't work.

Is there some nice way that I can put together some test cases to validate that things work as I expect? I normally would be looking into your test cases, to see how you do this, but I couldn't find them.

Part of the reason why testing is a priority is I'm uncertain that records are the best solution for this problem, as opposed to maps/multimethods and validating that data sent over there wire isn't being altered in some way would be great!

NoahTheDuke commented 2 years ago

You no doubt have figured something out, but for those who come across this, editscript doesn't support records.

Folcon commented 2 years ago

Hi @NoahTheDuke, I mean I mention it in the issue you linked to, I'm not sure if you're trying to figure it out yourself? I'd have to dig around for the code I used if so for a more complete example. You can however just extend the protocol as I mentioned in the issue to get records to be sent back and forth.

NoahTheDuke commented 2 years ago

Oh wow, I didn't realize that was you in that issue lol. My apologies for completely misunderstanding.

Folcon commented 2 years ago

No problem =)... Let me know if you need help!