Overview
This demo uses Myra Codec to generate a payload and Myra Transport to send ping and pong messages between
a client and server. Registered buffers and the NIO backend are configured via TransportConfig.
Clone and run
-
Install Java 25 and Git, then confirm the toolchain.
java --version -
Clone the examples repository.
git clone https://github.com/mvp-express/examples.git -
Move into the Gradle ping pong example folder.
cd examples/myra-codec-transport-ping-pong-gradle -
Generate sources and the lock file.
./gradlew codegen -
Start the server in one terminal.
./gradlew runServer -
Start the client in another terminal.
./gradlew runClient
The Gradle tasks enable preview and native access flags automatically. On Windows, use
gradlew.bat.
Concepts highlighted
- Codec generated
Payloadmessage for ping and pong. TransportConfigwith the NIO backend and registered buffers enabled.- Server side polling via
TransportBackendand explicit send/receive flow. - Client side
Transportwith callbacks inTransportHandlerAdapter. - Pooled buffers and scratch segments for low allocation throughput.
Files to explore
src/main/resources/schemas/ping_pong.myra.ymlsrc/main/java/express/mvp/myra/examples/pingpong/PingPongServer.javasrc/main/java/express/mvp/myra/examples/pingpong/PingPongClient.java