A SputnikN transport messages generator
The chat ecosystem consists of several dependent repositories:
- Database code gen - Class generator according to the DB schema, the DB schema is attached;
- Transport code gen - Transport message generator between Client and Server;
- Chat server - High loaded and scalable chat server written with Akka/Ktor/Rest/WebSocket/Protobuf/Jooq;
- Client chat SDK - SDK client chat library for embedding in third-party applications written in Flutter;
- Sample application - An example of a chat application using the SDK client library written with Flutter;
Do that once.
Download and unpack Protobuf compiler
We need a protoc
executable binary, download it here for your platform:
https://github.com/protocolbuffers/protobuf/releases/
Then unpack that and put that Path including subdirectory bin
into system/user variable named PATH
Do that once.
Install Dart plugin supporting Protobuf
, run command:
dart pub global activate protoc_plugin
Then add specific plugin directory into system/user variables named PATH
:
- for Windows:
$HOME/AppData/Local/Pub/Cache/bin
- for Unix/MacOS systems:
~/.pub-cache/bin
Do that once.
We need to build project to generate Serializer builder
Run in project directory: gradle build
or ./gradlew build
Do that every time Proto
messages is changed.
To generate Dart/Kotlin classes we should do below
Run in project directory: gradle :genProto -x test
or ./gradlew :genProto -x test
After generation the target files will be copied to destination projects
ATTENTION:
Destination folders generated
of the projects is cleanup before generation to keep actual and fresh classes!
Keep in mind to generate database layer objects after Proto
generation.
As socket send/receive messages in async way we need to have control over what exact response do we receive in specific time.
In that case we implemented TransportRequest / TransportResponse
message that have queueId
field and there we store some sequence id
for specific request, when we receive response we always know what exact Future
at client should be completed.