https://kotlinlang.org logo
#ktor
Title
# ktor
j

Jared Woolston

05/17/2020, 9:56 PM
Does anyone know if its possible to use the content negotiation's serialization configuration in a Websocket handler? Specifically, I have a Content Negotiation config like:
Copy code
install(ContentNegotiation) {
     // JSON Config
     json(Json(JsonConfiguration.Default.copy(encodeDefaults = false, classDiscriminator = "class"),
          apiModelSerializerModule), ContentType.Application.Json)
     // CBOR Config
     serialization(ContentType.Application.Cbor, Cbor(encodeDefaults = false, context = apiModelSerializerModule))
     // Protobuf Config
     serialization(ContentType.Application.ProtoBuf, ProtoBuf(encodeDefaults = false,
          context = apiModelSerializerModule))
}
And I would like to automatically handle a data object that is dealt with by the
apiModelSerializerModule