Open 0x53A opened 5 years ago
I was thinking about changing the serializer to the same as Fable.Remoting as it seems to be working ok for the same use case. I hope the bundle size won't get out of control, because the changelog of Thoth says that it should have better bundle size with that new version.
I'll do some tests. Thanks for letting me know!
One issue I had with the Remoting serializer is that it doesn't allow you to inject serializers for your own classes.
That means anything except built-ins, tuples, unions, records, doesn't work.
I haven't looked too deep into it, but theoretically, the extra/custom serializers might solve this for Thoth.
On the other hand, I doubt this is really a common scenario for Elmish.Bridge, 99.99% of the time you probably just want to exchange a small union type.
I uploaded a version using the same serializer as Remoting with a small tweak that check the base server union type and auto register every type used inside it if there is no ambiguity. But yes, the recommended scenario is to exchange the messages as an union type.
I added a crude custom serializer support on the pre2
version. The support now is just for the messages the client sends and the server receives. As the server only sends a specific type to the client, maybe that should be enough.
Actually there is a problem with the custom deserializer as it requires converion to exact server message. What if I have something like type String50 = private String50 of string
. Then it just doesn't work.
Thoth.Json 3 is currently in beta.
When I tried to use Thoth.Json 3.0.0-beta-002 with Elmish.Bridge.Client 2.0.1, I got this error: