This is a reasonable proposal, maybe it needs to go to the Proposals section on the forum for better visibility?
There is still no official way to serialize JS commands on the server side.
Here’s an example use case of exec’ing server-pushed JS commands: Animating list items with LiveView streams - #6 by rhcarvalho.
What I found is that, in testing, JS commands are serialized using Phoenix.HTML.Safe.to_iodata(), but that HTML-encodes the input, making it not directly usable on client JavaScript (e.g. " becomes ".
What works is what is described in the OP, JSON-encoding the :ops field of the struct, with no forward-compatibility guarantee.




















