payloadSerializersModule

val payloadSerializersModule: SerializersModule

A SerializersModule for the HubPayload, preconfigured to work with open-polymorphism. It works only for ProtoBuf serialization, due to the structure of the SerializersModule.

To use it together with the application serializer's module you can add it like this:

 // set up ProtoBufBuilder
val format = ProtoBuf {
val applicationModule = SerializersModule {
polymorphic(MyClass::class) {
subclass(MyApplicationSerializer)
}
}
serializersModule = payloadSerializersModule + applicationModule
}

Limitation

Serialization works only with ProtoBuf format, because the json serializer cannot serialize primitive types polymorphically with class discriminator, for example: for int of kind INT. See issue #274 for more details.