A Go-based real-time tracking service using WebSocket, gRPC, and Redis for persistent geolocation data.
- WebSocket API to receive live position updates from clients.
- gRPC API for backend services to retrieve current positions.
- Redis storage for fast reads and writes.
- Thread-safe client connection management.
- Basic error handling and logging.
- Go 1.21+
- Redis 7+
- Protocol Buffers Compiler (
protoc)
git clone https://github.com/<your-username>/<your-repo>.git
cd <your-repo>
go mod tidySet the required environment variables:
export REDIS_ADDR="localhost:6379"
export REDIS_PASSWORD="yourpassword"
export GRPC_PORT="50051"
export WS_PORT="8080"go run cmd/server/main.go- Connect to:
ws://localhost:8080/ws - Send handshake JSON:
{
"item_id": "your-item-id"
}- Send position updates:
{
"latitude": 35.6895,
"longitude": 139.6917
}The gRPC service exposes:
- GetCurrentPosition — Retrieve the latest position for an item.
Example gRPC call in Go:
resp, err := client.GetCurrentPosition(ctx, &pb.ItemRequest{ItemId: "your-item-id"})
if err != nil {
log.Fatal(err)
}
fmt.Println(resp)Current release: v0.1.0
Following Semantic Versioning.
MIT License