This is a simple example that demonstrates the basic request-response pattern using the cmd-stream library. Unlike other examples that use the high-level Sender, this example shows how to use the low-level Client directly.
- Direct Client Usage: Demonstrates how to create and use a
ccln.Clientfor sending individual Commands. - Async Results: Shows how to handle Results via Go channels using the
client.Sendmethod.
- Message: A simple string-based Command and Result type.
- ClientCodec & ServerCodec: Simple custom codecs for the
Messagetype.
From the root of the echo directory, run:
go run .Starting server on 127.0.0.1:9000...
Connecting to server...
Sending message: "one two three"
Received echo... Result: "one two three"