<https://developers.googleblog.com/2021/11/announcing-kotlin-support-for-protocol.html>
e
πŸ—οΈ 3
πŸ‘Œ 11
πŸ‘ŒπŸ» 1
πŸŽ‰ 9
🧨 2
K 19
m
While it's nice Google provides an official implementation for Kotlin, I recommend https://github.com/open-toast/protokt. It's nicer to use as it is kotlin-only (instead of kotlin-java mix), including nice handling of `optional`fields, and has a potential of being multiplatform.
K 2
πŸ’― 1
πŸ™ 1
s
@mcpiroman since 1.2 onwards kotlinx-serialization has support for generating the schema (
.proto
) and it’s already multiplatform ready, are there any advantage in using protokt?
m
Mainly proto3. I don't quite know how kotlinx-serialization works (have not used it) but, at least for now, I would also expect faster compilation or slightly better usage of the wire (being on lower level). There were also problems with combining kotlinx-serialization and Compose in the same module but I don't think this is much of a breaker.
πŸ™ 1
e
the official protobuf generator produces a Kotlin DSL which kotlinx.serialization doesn't (although you could write your own). protokt does, though I haven't compared them
note that only kotlinx.serialization works on non-JVM platforms; protobuf and protokt both use Java code and/or JVM libraries
also there seem to be some issues in the current Kotlin compiler, unfortunately https://youtrack.jetbrains.com/issue/KT-47270
πŸ‘ 1
j
java protocol buffers: when you absolutely positively require heap buffers for your network IO.