Skip to content

Commit 5b5d35c

Browse files
committed
[mod] [BREAKING] Move to more flexible packer interface (wip)
This is a BREAKING change for anyone using a CUSTOM packer (i.e. anything besides the built-in :edn or transit packers). The OLD interface (IPacker): (pack [packer clj-val]) -> platform-binary/string (unpack [packer packed-val]) -> clj-val The NEW interface (IPacker2): (pack [packer websocket? clj-val cb-fn]) -> (cb-fn {:value <platform-binary/string>} or {:error <platform-error>}) (unpack [packer websocket? packed-val cb-fn]) -> (cb-fn {:value <clj-val> or {:error <platform-error>}) Motivation? The new interface: - Allows custom implementations depending on transit type (WebSocket/Ajax). - Supports binary encoding for both WebSocket and Ajax transit (previously only WebSockets supported binary encoding). - Asynchronous encoding, opening a lot more options for client-side serialization and/or compression. Many JS serialization and compression libs are async only. Need to migrate your custom IPacker->IPacker2? Migration should usually be straight-forward, but if you run into any unexpected issues please feel free to ping on the Sente Slack channel or on GitHub. Both are linked at https://www.taoensso.com/sente. - Peter Taoussanis
1 parent dd60568 commit 5b5d35c

File tree

3 files changed

+362
-375
lines changed

3 files changed

+362
-375
lines changed

0 commit comments

Comments
 (0)